Hi,
I’ve downloaded a new revision for the library Aspose.Words.jdk16.jar (now i’ve got the 10.0.1 revision).
Now I’ve got some problem when I save a document into HTML format.
I’ve got a docx file, with special tag called ‘pastille’ using a font called ‘Numero’ (see texte_annexes_pastillé.docx joined to this topic).
I change some value in these tags with a java method in order to transform this font into a simple text like ‘(1)’ and then I save the document in html format. (see the 2 html files joined to this topic).
I use my own DocumentVisitor wich just change a Text into a Run object:
run.setText("(" + countPastille + ")");
private static void remplacerPastillage(Document doc)
{
Visitor myConverter = new Visitor();
try
{
doc.accept(myConverter);
}
catch (Exception e)
{
e.printStackTrace();
}
}
private void remplacerPastille(Paragraph para, Border leftBorder)
{
Shape shape = (Shape) para.getChild(NodeType.SHAPE, 0, true);
leftBorder.clearFormatting();
if (shape != null)
{
try
{
Paragraph sousParagraph = (Paragraph) para.getChild(NodeType.PARAGRAPH, 0, true);
if (sousParagraph != null)
{
sousParagraph.getParagraphFormat().setStyleName("StylePastille");
}
countPastille++;
Run run = (Run) para.getChild(NodeType.RUN, 0, true);
if (run != null)
{
run.setText("(" + countPastille + ")");
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
code OK
OutputStream os = new java.io.FileOutputStream(temporayFile);
doc.getSaveOptions().setHtmlExportImagesFolder("/" + imagesDirectory);
doc.getSaveOptions().setHtmlExportHeadersFooters(false);
doc.getSaveOptions().setHtmlExportPageSetup(false);
doc.getSaveOptions().setHtmlExportAllowNegativeLeftIndent(true);
doc.getSaveOptions().setHtmlExportDocumentProperties(true);
doc.getSaveOptions().setHtmlExportTextInputFormFieldAsText(true);
doc.getSaveOptions().setHtmlExportCssStyleSheetType(CssStyleSheetType.EMBEDDED);
doc.save(os, SaveFormat.HTML);
Result
(1)
Ligne
code NOK
HtmlSaveOptions saveOptions = new HtmlSaveOptions();
saveOptions.setImagesFolder("/" + imagesDirectory);
saveOptions.setExportHeadersFootersMode(ExportHeadersFootersMode.NONE);
saveOptions.setExportPageSetup(true);
saveOptions.setAllowNegativeLeftIndent(true);
saveOptions.setExportDocumentProperties(true);
saveOptions.setExportTextInputFormFieldAsText(true);
saveOptions.setCssStyleSheetType(CssStyleSheetType.EMBEDDED);
doc.save(temporayFile, saveOptions);
Result
Ligne