We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Converting HTML to Word Doc - Css support?

Hi

We are attempting to insert html into a word document using paragraph.AppendHTML(html).

This works fine except that <style> tags don't seem to work. Inline styles work, but normal style selectors and classes do not:

This works (the text is red):
<div style="color:red;">this text should be red</div>

This does not (the text is not red):
<style>
            .mydiv {
                color: red;
            }
</style>
<div class="mydiv">this text should be red</div>

Does DocIO support any style tag conversion at all when it imports html? If not, what is my best approach for creating universal styles for an html based word document?

10 Replies

SK Sathish K Syncfusion Team April 23, 2014 03:44 PM UTC

Hi Andy,

 

Thank you for your interest in Syncfusion products.

 

Currently DocIO doesn’t have support to preserve CSS in HTML to Word document conversion. We have logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We will update you when this feature has been implemented.

 

As a workaround kindly define all the styles inline to preserve desired styles during the conversion process.

 

Please let us know if you have any other questions.

 

Regards,

Sathish



CC Chris Crowhurst September 11, 2014 11:41 AM UTC

Hi,

I am experiencing the same issues as Andy.

Does the latest version support CSS in HTML, or is this still to be implemented ? I am currently using Essential Studio 12.1.0.43?

Regards

Chris


JA Jan February 12, 2016 04:03 PM UTC

Hi,

any updates or still not supported?

Regards,
Jan


SV Sarathkumar V Syncfusion Team February 15, 2016 09:22 AM UTC

Hi Jan,

Thank you for using Syncfusion products.

DocIO still doesn’t have support to preserve CSS in HTML to Word document conversion. We have logged this as a feature request in our database. We will implement this feature in any of our upcoming releases. We usually have an interval of at least three months between releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. We will update you when this feature has been implemented.

As a workaround kindly define all the styles inline to preserve desired styles during the conversion process.

Regards,
Sarath



PS Peruri Srinivasulu September 22, 2016 12:54 AM UTC

Hi,

Is it implemented now? Any update on this?

Thank you.


PE Priyanga Elangovan Syncfusion Team September 22, 2016 06:01 AM UTC

Hi Andy,

Thank you for contacting Syncfusion support.

DocIO still doesn’t have support to preserve CSS in HTML to Word document conversion. We have a plan to implement this feature in any of our upcoming releases. The feature implementation would also greatly depend on the factors such as product design, code compatibility and complexity. At the moment we are unable to provide concrete timeline for adding this support. We will let you know once this feature has been implemented.

As a workaround kindly define all the CSS styles as inline to preserve desired styles during the conversion process.

Regards,
Priyanga.E
 



TN Trevor Nguyen July 30, 2019 10:56 PM UTC

Has CSS support been implemented? Thanks...



PR Poorani Rajendran Syncfusion Team July 31, 2019 10:39 AM UTC

Hi Trevor,

Thank you for contacting Syncfusion support.

Currently DocIO doesn’t provide full-fledged support for CSS style sheet in HTML to Word conversion. This feature is to preserve CSS styles while importing HTML files is supported with limited CSS selectors.
The following CSS selectors are supported in Essential DocIO's HTML import functionality at present,
1. IDSelector
2. ClassSelector
3. DescendantSelector
4. ElementSelector
5. ChildSelector

Kindly provide us your input HTML file so that we can analyze further in line with your requirement and provide appropriate solution at the earliest.

Please let me know if you have any other questions.

Regards,
Poorani Rajendran



TA Tawani Anyangwe November 26, 2019 10:03 PM UTC

Has this feature been implented? Does DocIO now support CSS classes?


PR Poorani Rajendran Syncfusion Team November 27, 2019 09:44 AM UTC

Hi Tawani,


Thank you for contacting Syncfusion support.


As mentioned in our previous update (Updated on 7/31/2019), this feature is to preserve CSS styles while importing HTML files is supported with limited CSS selectors (which is mentioned in our previous update). Still, DocIO doesn’t provide full-fledged support for CSS style sheet in HTML to Word conversion. We don’t have any immediate plans to implement this feature. We will let you know when this feature is implemented.

Please let me know if you have any other questions.


Regards,
Poorani Rajendran.


Loader.
Live Chat Icon For mobile
Up arrow icon