Convert html to formatted text c#
The application outputs an HTML content by taking 2 inputs, an XML file containing the employee data and an xlst file used for transformation. The xslt has embedded HTML tags for formatting.
What could be the best way to output an RTF content with the same 2 inputs?
1. Render the HTML content to webbrowser and copy it to Richtextbox and convert to rtf -> formatting is lost
2. Converting HTML to Doc/RTF needs Office API's/installation at client place which is not advisible
3. XSLCompliedTrans can generate an .rtf file but there are not RTF tags (so its not pure RTF content)
Thanks for posting in the MSDN Forum.
Would you please use following snippet:
I hope it can help you.
Have a good day,
- Marked as answer by 许é³(æ é¡) Moderator Friday, October 12, 2012 5:40 AM
All replies
Thanks for posting in the MSDN Forum.
Would you please use following snippet:
I hope it can help you.
Have a good day,
- Marked as answer by 许é³(æ é¡) Moderator Friday, October 12, 2012 5:40 AM
Disclaimer: I'm working for this company.
Sample code how to convert HTML string to RTF file:
- Edited by SautinSoft company Saturday, October 27, 2012 9:34 AM
Here is another solution that avoids the use of Office API and WebBrowser control:
The code uses this C# library for Word documents, it can enable you to achieve various manipulations on HTML and RTF formatted content, but also you can use any other Word format as well.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.