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

Free Support Forum - aspose.com

Custom CSS Styles during export document to epub format

Hi Team,

I want to add few custom css styles to exported epub document. I am using aspose.words.net for export word document to epub format.

I try with this code :

builder.InsertHtml("<h1>Heading1</h1><style type=\"text/css\">.MyCustomStyle {margin-top: 3em;}</style>");

H1 tag is working, but style element is not rendered in the out put epub file.

Goal: I want margin should be on “em” in epub file.

Any comments are highly appreciated

Thanks,
Arun Chandran C

Hi Arun,

Thanks for your inquiry. In your case, I suggest you please load the Html into separate Document and insert it into target document using DocumentBuilder.InsertDocument method. Hope this helps you.

If you still face problem, please share following detail for investigation purposes.


  • Please attach your input Word document.
  • Please attach your input Html document.
  • Please
    attach your target document showing the desired behavior.