Table of Contents

Class TextDocumentBuilder

Namespace
OdfKit.Text
Assembly
OdfKit.dll

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

title string

Returns

TextDocumentBuilder

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

title string
subtitle string

Returns

TextDocumentBuilder

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

title string
subtitle string
author string

Returns

TextDocumentBuilder

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

title string

The cover title. / 封面標題。

subtitle string

The cover subtitle. / 封面副標題。

author string

The author or organization name. / 作者或組織名稱。

dateText string

The 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

text string

Returns

TextDocumentBuilder

AddHeading(string, int)

Adds a heading paragraph at the specified outline level. 新增標題。

public TextDocumentBuilder AddHeading(string text, int level)

Parameters

text string

The heading text. / 標題文字。

level int

The outline level. / 大綱階層。

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

configure Action<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

configure Action<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

text string

Returns

TextDocumentBuilder

AddParagraph(string, Action<TextRunFormattingBuilder>?)

Adds a body paragraph to the document. 新增段落。

public TextDocumentBuilder AddParagraph(string text, Action<TextRunFormattingBuilder>? configure)

Parameters

text string

The paragraph text. / 段落文字。

configure Action<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

name string
columnCount int
gap OdfLength

Returns

TextDocumentBuilder

AddSection(string, int, OdfLength, Action<TextSectionBuilder>?)

Adds a multi-column section. 新增多欄區段。

public TextDocumentBuilder AddSection(string name, int columnCount, OdfLength gap, Action<TextSectionBuilder>? configure)

Parameters

name string

The section name. / 區段名稱。

columnCount int

The column count. / 欄數。

gap OdfLength

The column gap. / 欄間距。

configure Action<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

rows int
columns int

Returns

TextDocumentBuilder

AddTable(int, int, Action<TextTableBuilder>?)

Adds a text table. 新增文字表格。

public TextDocumentBuilder AddTable(int rows, int columns, Action<TextTableBuilder>? configure)

Parameters

rows int

The row count. / 列數。

columns int

The column count. / 欄數。

configure Action<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

TextDocumentBuilder

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

title string

Returns

TextDocumentBuilder

AddTableOfContents(string, int)

Adds a table of contents and immediately updates its content. 新增目錄並立即更新目錄內容。

public TextDocumentBuilder AddTableOfContents(string title, int outlineLevel)

Parameters

title string

The table of contents title. / 目錄標題。

outlineLevel int

The 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

configure Action<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

configure Action<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

styles OdfStyleSet

The 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

configure Action<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

theme OdfDesignTheme

The design theme. / 設計主題。

Returns

TextDocumentBuilder

The current builder instance. / 目前 builder 執行個體。