static void Main(string[] args) { using (HtmlToDocxConverter converter = new HtmlToDocxConverter()) { converter.ConvertHtmlToDocx("sample.html", "result.docx"); } // Open result file in default DOCX associated application Process.Start("result.docx"); }
public static void Convert2() { HtmlToDocxConverter converter = new HtmlToDocxConverter(); //Define the css for the html content converter.DefaultStyleSheet = ".para{font-size: 24px; color: #FF0000;}"; string htmlContent = "<p class=\"para\">Content with special style.</p><p>Content without style</p>"; converter.Load(htmlContent); File.WriteAllBytes("convert.docx", converter.SaveAsBytes()); }
static void Main(string[] args) { using (HtmlToDocxConverter converter = new HtmlToDocxConverter()) { converter.ConvertHtmlToDocx("sample.html", "result.docx"); } // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.docx"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); }
public static void Convert() { HtmlToDocxConverter converter = new HtmlToDocxConverter(); string htmlContent = File.ReadAllText("sample.html"); converter.Load(htmlContent); //Convert html to Word, and save it to local file using (var stream = File.OpenWrite("convert.docx")) { converter.Save(stream); } }