簡體   English   中英

如何使用 C# 在 Aspose.word 中獲取自定義目錄

[英]How to get Custom Table of Content in Aspose.word using C#

我在 Report 中工作並使用 Aspose.word。 我需要自定義目錄。 但在 Word 中,它只提供如下默認模板,

標題 1................................. 1

標題 1.1.................................................2

標題 1.2..................................3

但我需要如下目錄,

(1-3) 標題 1

      (Heading 1.1,Heading 1.2)

是否可以根據標題和副標題創建自定義目錄? 請發表您的意見...

在 Aspose.Words 中,您可以使用DocumentBuilder.InsertTableOfContents方法創建 TOC。 它接受定義目錄最終外觀的TOC 字段開關列表。 如果開關不允許您創建所需的 output,那么您可以遍歷文檔中的段落,檢查每個段落的樣式,如果是標題樣式,則編譯您自己的 TOC。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM