hi,
My goal is to be able to convert word to html without forcing the style. If the paragraph is in normal font
I do not want to have :
<p style=“text-align:justify; line-height:115%; widows:0; orphans:0; font-size:10.5pt”> <span style=“font-family:Calibri”>Chapitre 1,1</span></p>
but I would like to have :
<p > Chapitre 1,1 </p>
But if I have bold in addition to normal style, I would like to have the bold property.
Is there any easy way to proceed?
I tried to use opts.setCssStyleSheetType(CssStyleSheetType.EXTERNAL); to have the css apart from text but did not succeed.
Thank you in advance for your help.
Alexandre MB
@AlexandreMB,
Have you also tried the following option with latest version of Aspose.Words for Java i.e. 19.6?
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setPrettyFormat(true);
opts.setCssStyleSheetType(CssStyleSheetType.EMBEDDED);
In case the problem still remains, please ZIP and upload your 1) input Word document, 2) Aspose.Words generated HTML file showing the undesired behavior and your 3) expected HTML file showing the correct output here for testing. We will then investigate the issue further on our end and provide you more information.
Chapitre 1.zip (9.2 KB)
You will find enclosed the very simple document as an example.
I did the following code:
HtmlSaveOptions opts = new HtmlSaveOptions(SaveFormat.HTML);
opts.setCssStyleSheetType(CssStyleSheetType.EMBEDDED);
// opts.setCssStyleSheetType(CssStyleSheetType.EXTERNAL);
// opts.*setCssStyleSheetFileName("/tmp/cssFile.css");
opts.setPrettyFormat(true);
opts.setExportImagesAsBase64(true);
state.htmlBuffer.append(p.toString(opts));
System.err.println("example : " + p.toString(opts));
and I have the following output: example:
<p style="text-align:justify; line-height:115%; widows:0; orphans:0; font-size:10.5pt"><span style="font-family:Calibri">Chapitre 1,1</span></p>
@AlexandreMB,
We have logged your requirement/problem in our issue tracking system. Your ticket number is WORDSNET-18782. We will further look into the details of this issue and will keep you updated on the status of the linked issue.
@AlexandreMB,
Regarding WORDSNET-18782, please provide complete details of your usecase and how you are going to use such HTML documents and what problem you are trying to solve. We will then investigate the scenario further on our end and provide you more information. Thanks for your cooperation.