For simple instances, you may just write out the HTML to a .docx document in c# https://www.iditect.com/tutorial/html-to-docx/. Sample listed here. That’s limited, though, and triggers the customer to spare as HTML if they create updates.
Exists a way to convert a HTML formmatted string to a Word document? I tried utilizing tinybutstrong yet it does not appear to convert any type of html tags.
I must do this a handful of years back as well as found yourself spinning my personal customized option. I generated a Word document in the style I yearned for, spared as HTML, and afterwards included regulation where demanded to retrieve text from the data bank and also style the way MS Word likes it. I required a header to create the customer believe it was acquiring a Word Document instead of an HTML report. Microsoft Word happily opened the report as if it were actually a frequent Word Document.
You might would like to make an effort delivering the HTML data as DOC (comparable to how it’s defined hyperlink text, yet with the suitable Contet-Type header:–RRB-) and allow the end-user’s unit perform the conversion (AFAIK you may do one thing identical along with Excel very).
I have actually discovered an outstanding HTML to PDF converter in Prince XML. Right now I am actually trying to find something of identical high quality to produce Word documents coming from HTML + CSS. This gets on PHP/Linux.
You can not simply write out HTML, offer it a.docx file name extension as well as count on Word to appropriately open up that document. A.docx file requires to become a valid Office Open XML plan, which primarily is a zip container along with different XML reports in it (you can easily find that through renaming a .docx document to.zip and afterwards open it making use of a standard zip tool).
If it were actually practical to output a DOCX data rather, you can carry out an XSL tranform.
You need to work along with Word 2003’s XML format if you require to support Word 2003. It’s different than the 2007 style, yet is at minimum forward compatible (so it’ll deal with 2007 at the same time). The simplest method is to conserve as a Word 2003 XML document from Word, at that point open up the document in a text editor, then come to function creating XSLT that will definitely convert your HTML to the appropriate XML. I have actually performed it, as well as it worked, however it was a considerable amount of work. There is actually facts on the format below.
If you may call for Word 2007, you may generate Office Open XML, which is actually primarily a zip data which holds XML documents. I haven’t located a public library that may do that, but you may get started by renaming a sample.docx data to a.zip file as well as taking a look at what is actually included, then create that from PHP. Some information on that particular in this particular SO question.
Listed below is one choice for pdf => doc. Have not attempted it, good luck!
What you can do right now to deal with the problem as well as obtain a legitimate Word data:
As opposed to HTML, generate a legitimate docx file utilizing Microsoft’s Open XML SDK. There a samples featured with the SDK that reveal you just how to make Word documents from it.
, if you can’t modify coming from producing HTML you are actually also capable to install HTML into a Word document utilizing a so-called altChunk.. This is described in yet another response here.
Depending on the information that you produce, there could also be the probability to make a theme Word document, where you simply need to have to fill placeholder. You only need to have to change a solitary XML report in the docx bundle to fill your document.