Adding multiple CSS by reference

Add-in Express™ Support Service
That's what is more important than anything else

Adding multiple CSS by reference
How can I add several CSS references ? 
George Kierstein

Posts: 47
Joined: 2013-05-04

I have the URL to several style sheets that I want to embed in a page. The example uses a createStyleSheet call:

                for (int i = 0; i < cssCount; i++)
                    mshtml.IHTMLStyleSheet styleSheet = this.HTMLDocument.createStyleSheet("", 0);
                    string url = mVersionObj.GetCss(i);
                    styleSheet.href = url;

This doesn't do what I would expect. It does some strange alteration to the <head> tag (something with a JQuery in it) and although it does appear to put *something* as a style sheet its not creating a style sheet with a ref in it.

Am I looking to actually embed a <link> tag instead ?

i.e. <link href="" rel="stylesheet" type="txt/css"/>

How would I go about getting them properly embedded ?

Posted 04 Jun, 2013 00:23:38 Top
Sergey Grischenko

Add-in Express team

Posts: 7235
Joined: 2004-07-05
Hi George,

Please try to change the code as shown below:

for (int i = 0; i < cssCount; i++)   
    string url = mVersionObj.GetCss(i);   
    mshtml.IHTMLStyleSheet styleSheet = this.HTMLDocument.createStyleSheet(url, 0);   
Posted 04 Jun, 2013 04:27:40 Top