How to insert a chart directory?

@Crane What you are asking about is Table of Figures. It is inserted into MS Word documents as TOC fields with appropriate flags:

Document doc = new Document("C:\\Temp\\in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);
    
builder.insertField("TOC \\h \\z \\c \"Figure\"");
    
doc.updateFields();
doc.save("C:\\Temp\\out.docx");

You can press Alt+F9 in MS Word to see field code.

Where is the documentation for this API and each parameter, can you tell me?

documentBuilder.insertField("TOC \\h \\z \\c \"表\"");

error : No table of figures entries found.

Why do I report this error, I use word to do this to generate it correctly

@Crane Please see TOC field codes to lean more about it’s switches. The error occurs because there are no SEQ fields with label in your document.

Thanks, I didn’t call doc. updateFields()

1 Like