受欢迎的博客标签

Aspose.Word Convert to html and pagination

Published
 use HtmlFixedSaveOptions.PageIndex and HtmlFixedSaveOptions.PageCount properties to export a single page to HTML format as follows:   Document doc = newDocument(@"C:\Temp\in.doc");   HtmlFixedSaveOptions saveOptions = new HtmlFixedSaveOptions(); saveOptions.PageIndex = 0; saveOptions.PageCount = 1;   doc.Save(@"C:\temp\out.html",saveOptions); Document doc = new Document("D:\jason\testDemo.docx"); HtmlFixedSaveOptions fixedOption = new HtmlFixedSaveOptions(); fixedOption.setPageIndex(0); fixedOption.setPageCount(1); fixedOption.setPrettyFormat(true); fixedOption.setExportEmbeddedCss(true); fixedOption.setExportEmbeddedFonts(true); fixedOption.setPrettyFormat(true); fixedOption.setUseHighQualityRendering(true); fixedOption.setSaveFormat(SaveFormat.HTML_FIXED); doc.save("D:\jason\testDemo.html", fixedOption);   After I opened the testDemo.html in IE8, the content messed up, and you can get this from the attachment testDemo.JPG which is the screenshot of the testDemo.html. Note that in FireFox and Google Chrome of my local computer, the format of the html looks good. It looks that IE 6, 7 or 8 don't support CSS3. But maybe our production will be used in IE6, 7 or 8 for a long time, we must consider this case.   he problem occurs because IE6, 7 and 8 do not support CSS3: http://www.w3schools.com/cssref/css3_browsersupport.asp In fixed page HTML we extensively use CSS3 features, especially transformation matrixes. As a workaround, I would suggest you to use some fallback for viewing documents in I IE6, 7 and 8. For example you can use Simple image, SVG or SWF as fallback. I think in your case SWF fallback would be preferred because I IE6, 7 and 8 have limited support of SVG. Let me know if using SWF is acceptable option for you. .