Hello,
We are using Aspose Word v14.7.0 with JDK 1.6 to concatenate multiple DOC and DOCX together. At the end of the process we are calling the updateFields() method just before saving the file.
When the source file is a DOC everything works, but when it is a DOCX and the table of content has been customized to modify the levels of the styles in the table of contents, at the end the table of content is blank, but it shouldn’t because after that if we re-update it manually it update correctly.
Here is a minimal test to re-produce the problem:
- Java:
import com.aspose.words.Document;
import com.aspose.words.SaveFormat;
import java.lang.Exception;
class Main {
public static void main (String [] args) {
try {
Document doc = new Document("C:\\temp\\test.docx");
doc.updateFields();
doc.save("C:\\temp\\test_out.docx", SaveFormat.DOCX);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Docx in attachement. The table of content is parametrized to show the style “Title” at the level 1, the style “Heading 1” at the level 2, the style “Heading 2” at the level 3.
We have tested with custom styles, it works correctly, but we need this to work with default styles too.
Thanks.