html turn into a word
/// <the Summary> /// addresses turn word html files need to create a template word, and then specify a new word file /// </ the Summary> /// <param name = "the templatePath"> coding encryption used embodiment </ param> /// <param name = "newFilePath"> encoding used to encrypt </ param> /// <param name = "HTML"> plaintext to be encrypted </ param> /// <Returns> </ Returns> public static void HtmlToWord ( String the templatePath, String newFilePath, String HTML) { // load the word template. Aspose.Words. Aspose.Words.Document(string.Format(@"{0}", templatePath)); Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder(doc); builder.InsertHtml(html); doc.Save(newFilePath, Aspose.Words.SaveFormat.Doc); }
html converted into pdf
/// <summary> /// html转pdf /// </summary> /// <param name="path"></param> /// <param name="newFilePath">加密采用的编码方式</param> /// <returns></returns> public static void HtmlToPdf(string path, string newFilePath) { var dir = newFilePath.Substring(0, newFilePath.LastIndexOf("/") + 1); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } Aspose.Words.Document doc = new Aspose.Words.Document(path); doc.Save(newFilePath); }