문제

I have the following problem: I'd like to create a dynamic table of content using aspose.words and vb.net. I did it using this code:

Dim doc As New Document()
Dim builder As New DocumentBuilder(doc2)
builder.InsertTableOfContents("""\o ""1-3"" ""\h ""\z ""\u")
builder.InsertBreak(BreakType.PageBreak)
[...]
doc.UpdateFields()
doc.Save(tempPath, SaveFormat.Docx)

and it works. The problem is that when no table of content entries are found I obtain in my docx:

No table of contents entries found.

Is it possible to write something like that (pseudo-code):

If (no_entries_found) Then
    table_of_content.display=false
Endif

Thanks so much,

Daniele

도움이 되었습니까?

해결책

I resolved using a workaround... if the content is equal to "No table of contents entries found." i replace it with "". If someone has better ideas I'll be glad to hear them.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top