Single word Font is lost(DOCX to HTML)


#1

Hi all! I faced with issue. When we are losing formatting of single word.
Steps to reproduce:

  1. Create document with not formatted word i.e.
    SomeWord
  2. Enable chenges tracking.
  3. Add break line before SomeWord.
  4. Add space before SomeWord.
  5. Add break line after SomeWord.
  6. Make ‘Word’ part of SomeWord bold.
  7. Try to process this document.
    Result: Bold formatting is lost(SomeWord instead of SomeWord). Same for java object representation & for corresponding html.
    Expected result: Formatting is ok.

#2

@evst,

We tested with these input/output Word documents (SomeWord.zip (19.3 KB)) and the following Aspose.Words for Java 19.8 code. The formatting in output document is fine.

Document doc = new Document("E:\\Temp\\SomeWord.docx");
doc.save("E:\\Temp\\awjava-19.8.docx");

Please upgrade to the latest version. Hope, this helps.


#3

Thank you for response! I’m sorry, I didn’t correctly write steps. I’ve tried to save to html.
Like this:
public static void main(String[] args) throws Exception {
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions(SaveFormat.HTML);
htmlSaveOptions.setPrettyFormat(true);

    Document doc = new Document(new FileInputStream("./src/main/resources/SomeWord(1).docx"));

    // Sing le word formatting
    doc.save("./SomeWord(1).docx", htmlSaveOptions);
}

Here is sample:
SomeWord(1).zip (9.4 KB)


#4

I’ve tried with current our version 19.5 and with version which you mention 19.8.


#5

@evst,

Please call Document.AcceptAllRevisions method before saving to HTML. Hope, this helps.