- Home
- Forum
- ASP.NET Web Forms
- Including a stylesheet with the InsertXHTML method
Including a stylesheet with the InsertXHTML method
Hello,
We are trying to import some XHTML from a HTML editor control (which includes things like TABLEs and DIVs) into a Word document using DocIO.
The TABLEs and DIVs have some class tags assigned that releate to a CSS stylesheet.
We can't find a way to link a CSS stylesheet and putting the StyleSheet code into the XHTML doesn't seem to do anything.
Inline styles do work (see screenshot)... any ideas?
IWParagraph paragraph = section.AddParagraph();
string htmlstring = Resources.Files.source;
section.Body.InsertXHTML(htmlstring);
Resources.Files.source
<html>
<head><style type="text/css">
.WarningBox {
border: solid 1px #AA0000;
background-color: #FFDDDD;
padding: 20px;
}
</style>
</head>
<body>
<div class="WarningBox">
Box with CSS style
</div>
<div style="border: solid 1px #AA0000; background-color: #FFDDDD; padding: 20px;">
Box with inline styles
</div>
</body>
</html>
Attachment: Styles_2dc81062.zip
SIGN IN To post a reply.
3 Replies
MJ
Mohanaselvam Jothi
Syncfusion Team
June 26, 2019 11:11 AM UTC
Hi David,
Thank you for contacting Syncfusion support.
On further analyzing on the given HTML, we have found that the preservation problem occurs due to internal CSS styles used in HTML. Currently DocIO have only support to preserve inline CSS styles in HTML to Word conversion and we doesn’t have support for internal and external CSS style sheet in HTML import. We have already logged this requirement as a feature request in our database. We don’t have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented and it can be tracked through below feedback portal link:
https://www.syncfusion.com/feedback/3059/export-word-documents-to-html-with-inline-css
Please let us know if you have any other questions.
Regards,
Mohanaselvam J
Thank you for contacting Syncfusion support.
On further analyzing on the given HTML, we have found that the preservation problem occurs due to internal CSS styles used in HTML. Currently DocIO have only support to preserve inline CSS styles in HTML to Word conversion and we doesn’t have support for internal and external CSS style sheet in HTML import. We have already logged this requirement as a feature request in our database. We don’t have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented and it can be tracked through below feedback portal link:
https://www.syncfusion.com/feedback/3059/export-word-documents-to-html-with-inline-css
Please let us know if you have any other questions.
Regards,
Mohanaselvam J
DH
David Homer
June 26, 2019 11:19 AM UTC
Hello,
Thank you for the reply. This is a very big limitation.
The source code of DocIO appears to support parsing StyleSheets inline though (see screenshot) perhaps it just doesn't work?
Thanks,
Dave
Attachment: AppendCssStyle_88a89203.zip
MJ
Mohanaselvam Jothi
Syncfusion Team
June 27, 2019 12:41 PM UTC
Hi David,
Thank you for your update.
DocIO partially supports the internal CSS stylesheet in HTML to Word conversion. Currently, we doesn’t provide complete support for preserving internal CSS styles in HTML conversions. We will consider your scenario in our feature request and it will be preserved properly once that feature is implemented. As mentioned in our previous update, we don’t have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented.
Please let us know if you have any other questions.
Regards,
Mohanaselvam J
Thank you for your update.
DocIO partially supports the internal CSS stylesheet in HTML to Word conversion. Currently, we doesn’t provide complete support for preserving internal CSS styles in HTML conversions. We will consider your scenario in our feature request and it will be preserved properly once that feature is implemented. As mentioned in our previous update, we don’t have any immediate plans to implement this feature. At the planning stage for every release cycle, we review all open features. We will let you know when this feature is implemented.
Please let us know if you have any other questions.
Regards,
Mohanaselvam J
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
DH David Homer
- Jun 25, 2019 04:39 PM UTC
- Jun 27, 2019 12:41 PM UTC