I have a rich textbox that saves its data as HTML. Basically just paragraph tags and simple formatting. I need to stick this text (with formatting) into a document that I am creating in wordprocessingML format. I was thinking of using an XSLT to convert, but that's about as far as I've got. Quick google search isn't turning up too muc开发者_运维知识库h in the form of examples or something free that I don't have to buy.
Any ideas?
I found your question when searching google for html to wordprocessingml today. The second hit was Converting an HTML table to WordProcessingML with XSLT, which should get you started on the right path. I still haven't found a full featured stylesheet that will handle multiple types of elements.
Another approach is the one found in the article "Dynamically generate a MS Word document using HTML & CSS". This approach adds very little to the HTML (some XML namespaces, a conditional comment targeting Outlook 2007 (?!) and a mix of proprietary and valid CSS styling) and procduces similar results with less processing. However, I've had trouble locating documentation on it. The styled entities (mso-header-margin
, for example) seem to date back to Office 2000. The documentation (really Microsoft, an executable that unpacks a CHM? You shouldn't have!) on these entities is dated, but it still seems to work for me in Word 2007.
精彩评论