We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Using custom stylesheet during doc to html conversion

Does Aspose.words support applying custom stylesheets during doc/docx to html conversion, like changing the font, background color and other styling info uisng a custom CSS?


Thanks for your inquiry. No, there is no such functionality. But you can save CSS stylesheet in a separate file and then change this file. See the following code example:

Document doc = new Document("in.doc");
doc.SaveOptions.HtmlExportCssStyleSheetType = CssStyleSheetType.External;
doc.Save("out.html", SaveFormat.Html);

Best regards.

Thanks for the info. I tried it out. Looks decent enough.

Are the css stylesheet class names generated by Aspose.word MS word style standards?
If I apply similar styles to 2 separate word docs, will the css class names for these 2 separate doc files on conversion to html, be the same?

Thanks for your inquiry. Yes, if your documents have the same styles names then names in CSS will be the same too. Names of styles in the generated CSS are matched to names of styles in the word document. But note white spaces in word styles names are ignored. And don’t use non English letters in styles names.
Best regards.