Class TextDocumentBuilder
Builds text documents with a fluent API. 提供 TextDocument 的 Fluent 建立 API。
public sealed class TextDocumentBuilder
- Inheritance
-
TextDocumentBuilder
- Inherited Members
Methods
AddCoverPage(string)
Short overload of AddCoverPage that accepts title; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 title;其餘可選參數使用預設值並轉呼叫最長 AddCoverPage 多載。
public TextDocumentBuilder AddCoverPage(string title)
Parameters
titlestring
Returns
AddCoverPage(string, string?)
Short overload of AddCoverPage that accepts title and subtitle; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 title 與 subtitle;其餘可選參數使用預設值並轉呼叫最長 AddCoverPage 多載。
public TextDocumentBuilder AddCoverPage(string title, string? subtitle)
Parameters
Returns
AddCoverPage(string, string?, string?)
Short overload of AddCoverPage that accepts title, subtitle, and author; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 title、subtitle 與 author;其餘可選參數使用預設值並轉呼叫最長 AddCoverPage 多載。
public TextDocumentBuilder AddCoverPage(string title, string? subtitle, string? author)
Parameters
Returns
AddCoverPage(string, string?, string?, string?)
Adds a cover page with a title, optional subtitle, author, and date text, inserting a page break after the cover. 新增封面頁,包含標題、可選副標題、作者與日期文字,並在封面後插入分頁。
public TextDocumentBuilder AddCoverPage(string title, string? subtitle, string? author, string? dateText)
Parameters
titlestringThe cover title. / 封面標題。
subtitlestringThe cover subtitle. / 封面副標題。
authorstringThe author or organization name. / 作者或組織名稱。
dateTextstringThe date or period text. / 日期或期間文字。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
AddHeading(string)
Short overload of AddHeading that accepts text; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 text;其餘可選參數使用預設值並轉呼叫最長 AddHeading 多載。
public TextDocumentBuilder AddHeading(string text)
Parameters
textstring
Returns
AddHeading(string, int)
Adds a heading paragraph at the specified outline level. 新增標題。
public TextDocumentBuilder AddHeading(string text, int level)
Parameters
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
AddList(Action<TextListBuilder>)
Adds a list and configures its list items. 新增專案清單。
public TextDocumentBuilder AddList(Action<TextListBuilder> configure)
Parameters
configureAction<TextListBuilder>The list content configuration delegate. / 清單內容設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
AddParagraph(Action<TextParagraphBuilder>)
Adds a paragraph composed of multiple text runs. 新增由多個文字片段組成的段落。
public TextDocumentBuilder AddParagraph(Action<TextParagraphBuilder> configure)
Parameters
configureAction<TextParagraphBuilder>The paragraph content configuration delegate. / 段落內容設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
AddParagraph(string)
Short overload of AddParagraph that accepts text; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 text;其餘可選參數使用預設值並轉呼叫最長 AddParagraph 多載。
public TextDocumentBuilder AddParagraph(string text)
Parameters
textstring
Returns
AddParagraph(string, Action<TextRunFormattingBuilder>?)
Adds a body paragraph to the document. 新增段落。
public TextDocumentBuilder AddParagraph(string text, Action<TextRunFormattingBuilder>? configure)
Parameters
textstringThe paragraph text. / 段落文字。
configureAction<TextRunFormattingBuilder>The paragraph style configuration delegate. / 段落樣式設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
AddSection(string, int, OdfLength)
Short overload of AddSection that accepts name, columnCount, and gap; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name、columnCount 與 gap;其餘可選參數使用預設值並轉呼叫最長 AddSection 多載。
public TextDocumentBuilder AddSection(string name, int columnCount, OdfLength gap)
Parameters
Returns
AddSection(string, int, OdfLength, Action<TextSectionBuilder>?)
Adds a multi-column section. 新增多欄區段。
public TextDocumentBuilder AddSection(string name, int columnCount, OdfLength gap, Action<TextSectionBuilder>? configure)
Parameters
namestringThe section name. / 區段名稱。
columnCountintThe column count. / 欄數。
gapOdfLengthThe column gap. / 欄間距。
configureAction<TextSectionBuilder>The section content configuration delegate. / 區段內容設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
AddTable(int, int)
Short overload of AddTable that accepts rows and columns; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 rows 與 columns;其餘可選參數使用預設值並轉呼叫最長 AddTable 多載。
public TextDocumentBuilder AddTable(int rows, int columns)
Parameters
Returns
AddTable(int, int, Action<TextTableBuilder>?)
Adds a text table. 新增文字表格。
public TextDocumentBuilder AddTable(int rows, int columns, Action<TextTableBuilder>? configure)
Parameters
rowsintThe row count. / 列數。
columnsintThe column count. / 欄數。
configureAction<TextTableBuilder>The table configuration delegate. / 表格設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
AddTableOfContents()
Short overload of AddTableOfContents that uses default values for all optional parameters and forwards to the full overload. 便利多載:AddTableOfContents 的所有可選參數使用預設值並轉呼叫最長多載。
public TextDocumentBuilder AddTableOfContents()
Returns
AddTableOfContents(string)
Short overload of AddTableOfContents that accepts title; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 title;其餘可選參數使用預設值並轉呼叫最長 AddTableOfContents 多載。
public TextDocumentBuilder AddTableOfContents(string title)
Parameters
titlestring
Returns
AddTableOfContents(string, int)
Adds a table of contents and immediately updates its content. 新增目錄並立即更新目錄內容。
public TextDocumentBuilder AddTableOfContents(string title, int outlineLevel)
Parameters
titlestringThe table of contents title. / 目錄標題。
outlineLevelintThe maximum outline level included in the table of contents. / 目錄大綱階層上限。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
Build()
Builds and returns the text document. 建立並傳回文字文件。
public TextDocument Build()
Returns
- TextDocument
The built text document. / 建立完成的文字文件。
WithMetadata(Action<TextDocumentMetadataBuilder>)
Configures the document metadata. 設定文件中繼資料。
public TextDocumentBuilder WithMetadata(Action<TextDocumentMetadataBuilder> configure)
Parameters
configureAction<TextDocumentMetadataBuilder>The metadata configuration delegate. / 中繼資料設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
WithPageSetup(Action<TextPageSetupBuilder>)
Configures the header and footer of the default page style. 設定預設頁面樣式的頁首與頁尾。
public TextDocumentBuilder WithPageSetup(Action<TextPageSetupBuilder> configure)
Parameters
configureAction<TextPageSetupBuilder>The page setup configuration delegate. / 頁面設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
WithStyles(OdfStyleSet)
Sets the style set this builder applies to subsequently created content. 設定此 builder 後續建立內容會套用的樣式集合。
public TextDocumentBuilder WithStyles(OdfStyleSet styles)
Parameters
stylesOdfStyleSetThe style set. / 樣式集合。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
WithStyles(Action<OdfStyleSet>)
Sets the style set this builder applies to subsequently created content. 設定此 builder 後續建立內容會套用的樣式集合。
public TextDocumentBuilder WithStyles(Action<OdfStyleSet> configure)
Parameters
configureAction<OdfStyleSet>The style set configuration delegate. / 樣式集合設定委派。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。
WithTheme(OdfDesignTheme)
Sets the design theme this builder applies to subsequently created content. 設定此 builder 後續建立內容會套用的設計主題。
public TextDocumentBuilder WithTheme(OdfDesignTheme theme)
Parameters
themeOdfDesignThemeThe design theme. / 設計主題。
Returns
- TextDocumentBuilder
The current builder instance. / 目前 builder 執行個體。