Convertto-HTML cmdlet inner workings

I am writing code that modifies the output of this cmdlet using <style> changes. I have embedded style changes in a “here string” within the code, and that works. I have also tried using -cssuri parameter and having the style info in a .css file on my computer. This approach didn’t seem to work, as the path I was placing after the -cssuri parameter also had to be a url that a browser could interpret. (This according to Don Jones.) After much investigation, I finally found a path form that looked legal. By that I mean, when I examined the resulting page in Firefox, (using right click, select “view page source”), I got this line in the HTML document :

<link rel="stylesheet" type="text/css" href="file:///C:/CSS/archive2.css" /

Note that the URL href value is underlined, but if I click on it, lo and behold, the .css style sheet opens up in Firefox. So apparently it’s valid. However, the simple styling changes (borders) don’t show up in the HTML page using this method, but they DO when placing the same CSS code in a here string. Then I tried opening the .html file created by Powershell in another browser, Internet Explorer. This time it did work, so there is something about Firefox… The only thing I can find that might be causing the style display problem is the character encoding in my version of Firefox is “UTF-16LE”. (Right click and select “view page info”) Most web pages should be in UTF-8 encoding… How does convertto-HTML do encoding? I can’t find anything. I also can’t determine what IE is using for encoding. Would encoding even be the source of the problem? Any ideas?

I suspect you have some formatting in your question the forum software can not deal with it!? Try to edit it again to fix it please.

@Olaf : Even I was trying to do preformatting like you asked me yesterday. but nothing was getting posted .

@pkarunakar17 … what should I say … I think it’s not that hard … in doubt you should first get rid of all pre existing formats and only format it with the provided options here in the forum post editor.