title: How to get all applied CSS Style info from mshtml element via C#
body: <p>I'm working on a C# application that needs to parse a web page and convert into another format. Without going too deep into the output format and use case etc. My problem is getting the computed CSS for any given element, in this case most of them. I'm dealing with a combination of inline styles, CSS, and formatting elements like <code>&lt;strong&gt;,&lt;em&gt;,&lt;u&gt;</code> etc.</p>
  
  <p>I'm currently loading the web page into mshtml and using the IHTMLElement2 interface to access the currentStyle object. this is proving to be too slow. I have profiled it and the significant time is spent getting the value of the style rule via the call to currentStyle.XXX . Since I need to query multiple properties i.e. background-color, font-family, font-size, text-align, text-decoration, etc. repeated by each element I'm doing thousands of COM calls and it's taking several minutes for a small document. All modern browsers do this is fractions of a second. I imagine it's the COM interop that's killing me?</p>
  
  <p>Is there a better way?
  I'd like to get all the computed Style rules that apply to the element in one shot.
  does anybody know how to use IHTMLElementAppliedStyles ? does it do what I'm looking for and where do you get an instance of it? side note: I'm referencing the HTML Object Library to get mshtml but it does not seem to be the IE9/10 version??? not all the interfaces are available i.e. IHTMLDocument7</p>
  
  <p>Thanks,</p>