Table of Contents

Class TextDocument

Namespace
OdfKit.Text
Assembly
OdfKit.dll

Provides the TextDocument API. 提供 TextDocument API。

public class TextDocument : OdfDocument, IDisposable, IAsyncDisposable
Inheritance
TextDocument
Implements
Derived
Inherited Members

Constructors

TextDocument(OdfPackage)

Initializes a new instance of the TextDocument class. 初始化 TextDocument 類別的新執行個體。

public TextDocument(OdfPackage package)

Parameters

package OdfPackage

The OdfPackage instance. / OdfPackage 封裝包執行個體。

Properties

Body

Gets the high-level operation entry point for the text document body. 取得文字文件本文的高階操作入口。

public OdfTextBody Body { get; }

Property Value

OdfTextBody

BodyTextRoot

Gets or sets the body root node of the text document. 取得或設定文字文件的本文根節點。

public OdfNode BodyTextRoot { get; }

Property Value

OdfNode

FormFields

Gets the collection of text and form fields in the document that can be filled in by name. 取得文件中可依名稱填入的文字與表單欄位集合。

public OdfFormFieldCollection FormFields { get; }

Property Value

OdfFormFieldCollection

Metadata

Gets the high-level operation entry point for document metadata. 取得文件中繼資料的高階操作入口。

public OdfDocumentMetadata Metadata { get; }

Property Value

OdfDocumentMetadata

TrackChanges

Gets or sets a value indicating whether change tracking is enabled. 取得或設定一個值,指出是否啟用修訂追蹤。

public bool TrackChanges { get; set; }

Property Value

bool

Remarks

這是 TrackedChanges 的計畫名別名,供呼叫端以 doc.TrackChanges = true 啟用修訂追蹤。

TrackedChanges

Gets or sets a value indicating whether change tracking (track changes) is enabled. 取得或設定一個值,指出是否啟用修訂追蹤(追蹤修訂)。

public bool TrackedChanges { get; set; }

Property Value

bool

Methods

AcceptAllChanges()

Accepts all tracked changes in the document. 接受文件中所有的追蹤修訂。

public void AcceptAllChanges()

AcceptAllTrackedChanges()

Accepts all tracked changes in the document. 接受文件中所有的追蹤修訂。

public void AcceptAllTrackedChanges()

AcceptChange(string)

Accepts the specified tracked change. 接受指定的追蹤修訂。

public void AcceptChange(string changeId)

Parameters

changeId string

The change identifier. / 修訂識別碼。

AddAlphabeticalIndex()

Short overload of AddAlphabeticalIndex that uses default values for all optional parameters and forwards to the full overload. 便利多載:AddAlphabeticalIndex 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfAlphabeticalIndex AddAlphabeticalIndex()

Returns

OdfAlphabeticalIndex

AddAlphabeticalIndex(string)

Adds an alphabetical index to the end of the document body. 新增字母索引至文件本文結尾。

public OdfAlphabeticalIndex AddAlphabeticalIndex(string title)

Parameters

title string

The index title. / 索引標題。

Returns

OdfAlphabeticalIndex

The created alphabetical index object. / 建立的字母索引物件。

AddBibliography()

Short overload of AddBibliography that uses default values for all optional parameters and forwards to the full overload. 便利多載:AddBibliography 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfBibliography AddBibliography()

Returns

OdfBibliography

AddBibliography(string)

Adds a bibliography to the end of the document body. 新增文獻目錄至文件本文結尾。

public OdfBibliography AddBibliography(string title)

Parameters

title string

The bibliography title. / 文獻目錄標題。

Returns

OdfBibliography

The created bibliography object. / 建立的文獻目錄物件。

AddChart(OdfParagraph, OdfChartDefinition, OdfLength, OdfLength)

Inserts an embedded chart in the specified paragraph. 在指定段落中插入嵌入式圖表。

public OdfNode AddChart(OdfParagraph paragraph, OdfChartDefinition chart, OdfLength width, OdfLength height)

Parameters

paragraph OdfParagraph

The target paragraph. / 目標段落。

chart OdfChartDefinition

The chart configuration definition. / 圖表設定定義。

width OdfLength

The chart display width. / 圖表顯示寬度。

height OdfLength

The chart display height. / 圖表顯示高度。

Returns

OdfNode

The OdfNode representing the chart object. / 代表圖表物件的 OdfNode 節點。

AddFontFace(string, string)

Short overload of AddFontFace that accepts name and fontFamily; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name 與 fontFamily;其餘可選參數使用預設值並轉呼叫最長 AddFontFace 多載。

public void AddFontFace(string name, string fontFamily)

Parameters

name string
fontFamily string

AddFontFace(string, string, string?)

Short overload of AddFontFace that accepts name, fontFamily, and genericFamily; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name、fontFamily 與 genericFamily;其餘可選參數使用預設值並轉呼叫最長 AddFontFace 多載。

public void AddFontFace(string name, string fontFamily, string? genericFamily)

Parameters

name string
fontFamily string
genericFamily string

AddFontFace(string, string, string?, string?)

Adds a font declaration item to the document. 在文件中新增字型宣告專案。

public void AddFontFace(string name, string fontFamily, string? genericFamily, string? pitch)

Parameters

name string

The font code or alias. / 字型代碼或別名。

fontFamily string

The actual font family name. / 實際的字型名稱。

genericFamily string

The generic font family. / 泛用字型系列。

pitch string

The pitch mode. / 字距模式。

AddFormControl(OdfControlType, string, OdfLength, OdfLength, OdfLength, OdfLength)

Short overload of AddFormControl that accepts type, name, x, y, width, and height; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 type、name、x、y、width 與 height;其餘可選參數使用預設值並轉呼叫最長 AddFormControl 多載。

public OdfFormControl AddFormControl(OdfControlType type, string name, OdfLength x, OdfLength y, OdfLength width, OdfLength height)

Parameters

type OdfControlType
name string
x OdfLength
y OdfLength
width OdfLength
height OdfLength

Returns

OdfFormControl

AddFormControl(OdfControlType, string, OdfLength, OdfLength, OdfLength, OdfLength, string)

Short overload of AddFormControl that accepts type, name, x, y, width, height, and label; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 type、name、x、y、width、height 與 label;其餘可選參數使用預設值並轉呼叫最長 AddFormControl 多載。

public OdfFormControl AddFormControl(OdfControlType type, string name, OdfLength x, OdfLength y, OdfLength width, OdfLength height, string label)

Parameters

type OdfControlType
name string
x OdfLength
y OdfLength
width OdfLength
height OdfLength
label string

Returns

OdfFormControl

AddFormControl(OdfControlType, string, OdfLength, OdfLength, OdfLength, OdfLength, string, IReadOnlyList<string>?)

Adds a form control to the document (draw:frame + office:forms definition). 在文件中加入表單控制項(draw:frame + office:forms 定義)。

public OdfFormControl AddFormControl(OdfControlType type, string name, OdfLength x, OdfLength y, OdfLength width, OdfLength height, string label, IReadOnlyList<string>? listItems)

Parameters

type OdfControlType

The control type. / 控制項類型。

name string

The control name (a unique identifier). / 控制項名稱(唯一識別字)。

x OdfLength

The control's left margin. / 控制項左邊距。

y OdfLength

The control's top margin. / 控制項上邊距。

width OdfLength

The control width. / 控制項寬度。

height OdfLength

The control height. / 控制項高度。

label string

The control's label text (checkbox, button) or default value (text field). / 控制項標籤文字(核取方塊、按鈕)或預設值(文字欄位)。

listItems IReadOnlyList<string>

The drop-down list options (valid only for ListBox). / 下拉式清單選項(僅 ListBox 有效)。

Returns

OdfFormControl

An OdfFormControl object describing the new control. / 描述新控制項的 OdfFormControl 物件。

AddHeading(string, int)

Adds a heading to the end of the document body. 新增一個標題至文件本文結尾。

public OdfHeading AddHeading(string text, int outlineLevel)

Parameters

text string

The heading's text content. / 標題的文字內容。

outlineLevel int

The heading's outline level. / 標題的大綱階層。

Returns

OdfHeading

The newly created heading instance. / 新建立的標題執行個體。

AddImageFrame(OdfParagraph, byte[], OdfLength, OdfLength)

Short overload of AddImageFrame that accepts paragraph, imageBytes, width, and height; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 paragraph、imageBytes、width 與 height;其餘可選參數使用預設值並轉呼叫最長 AddImageFrame 多載。

public OdfImage AddImageFrame(OdfParagraph paragraph, byte[] imageBytes, OdfLength width, OdfLength height)

Parameters

paragraph OdfParagraph
imageBytes byte[]
width OdfLength
height OdfLength

Returns

OdfImage

AddImageFrame(OdfParagraph, byte[], OdfLength, OdfLength, string?)

Adds an image frame in the specified paragraph. 在指定的段落中新增影像框架。

public OdfImage AddImageFrame(OdfParagraph paragraph, byte[] imageBytes, OdfLength width, OdfLength height, string? name)

Parameters

paragraph OdfParagraph

The target paragraph. / 目標段落。

imageBytes byte[]

The image's binary bytes. / 影像的二進位位元組。

width OdfLength

The image width. / 影像寬度。

height OdfLength

The image height. / 影像高度。

name string

The image name. / 影像名稱。

Returns

OdfImage

The OdfImage object representing the newly created image. / 代表新建影像的 OdfImage 物件。

AddList()

Short overload of AddList that uses default values for all optional parameters and forwards to the full overload. 便利多載:AddList 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfList AddList()

Returns

OdfList

AddList(string?)

Adds a list to the end of the document body. 新增一個專案清單至文件本文結尾。

public OdfList AddList(string? styleName)

Parameters

styleName string

The list style name. / 專案清單樣式名稱。

Returns

OdfList

The newly created list. / 新建立的清單專案。

AddListWithStyle(string, IReadOnlyList<OdfListLevelStyle>)

Creates a list with a multi-level style definition; the style is written to the office:styles section of styles.xml. 以多層級樣式定義建立清單,樣式寫入 styles.xml 的 office:styles 區段。

public OdfList AddListWithStyle(string styleName, IReadOnlyList<OdfListLevelStyle> levels)

Parameters

styleName string

The list style name, which must be unique. / 清單樣式名稱,必須唯一。

levels IReadOnlyList<OdfListLevelStyle>

The style settings for each level; the Level property must start at 1 and increase consecutively. / 各層級的樣式設定;Level 屬性需從 1 開始連續遞增。

Returns

OdfList

The newly created list, with the style name applied. / 新建立的清單(已套用樣式名稱)。

AddPageStyle(string)

Short overload of AddPageStyle that accepts name; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name;其餘可選參數使用預設值並轉呼叫最長 AddPageStyle 多載。

public OdfPageStyle AddPageStyle(string name)

Parameters

name string

Returns

OdfPageStyle

AddPageStyle(string, Action<OdfPageSetup>?)

Adds a named page style (master-page + page-layout), optionally configuring its settings. 新增一個具名頁面樣式(master-page + page-layout),並可選擇性地配置其設定。

public OdfPageStyle AddPageStyle(string name, Action<OdfPageSetup>? configure)

Parameters

name string

The master page style name (e.g. "Landscape"). / 主頁面樣式名稱(例如 "Landscape")。

configure Action<OdfPageSetup>

The optional page setup configuration callback. / 可選的頁面設定回呼。

Returns

OdfPageStyle

AddParagraph()

Short overload of AddParagraph that uses default values for all optional parameters and forwards to the full overload. 便利多載:AddParagraph 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfParagraph AddParagraph()

Returns

OdfParagraph

AddParagraph(string)

Adds a paragraph to the end of the document body. 新增一個段落至文件本文結尾。

public OdfParagraph AddParagraph(string text)

Parameters

text string

The paragraph's text content. / 段落的文字內容。

Returns

OdfParagraph

The newly created paragraph instance. / 新建立的段落執行個體。

AddSection(string, int, OdfLength)

Adds a multi-column layout section to the end of the document body. 新增多欄版面配置區段至文件本文結尾。

public OdfSection AddSection(string name, int columnCount, OdfLength gap)

Parameters

name string

The section name. / 區段名稱。

columnCount int

The number of columns. / 欄位數量。

gap OdfLength

The column gap width. / 欄間距寬度。

Returns

OdfSection

The newly created section object. / 新建立的區段物件。

AddSubDocumentReference(string, string)

Short overload of AddSubDocumentReference that accepts name and subDocumentUri; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name 與 subDocumentUri;其餘可選參數使用預設值並轉呼叫最長 AddSubDocumentReference 多載。

public OdfSection AddSubDocumentReference(string name, string subDocumentUri)

Parameters

name string
subDocumentUri string

Returns

OdfSection

AddSubDocumentReference(string, string, bool)

Adds a section referencing an external sub-document at the end of the document body (used for master documents). 在文件本文結尾新增一個指向外部子文件參照的區段(用於主文件)。

public OdfSection AddSubDocumentReference(string name, string subDocumentUri, bool loadOnRequest)

Parameters

name string

The section name. / 區段名稱。

subDocumentUri string

The relative or absolute URI/path of the external sub-document (written to xlink:href). / 外部子文件的相對或絕對 URI/路徑(將寫入 xlink:href)。

loadOnRequest bool

Whether to defer loading of the sub-document content (written as xlink:actuate="onRequest"); defaults to false, i.e. loaded immediately when the master document is opened (xlink:actuate="onLoad"). / 是否延遲載入子文件內容(寫入 xlink:actuate="onRequest");預設為 false, 即開啟主控文件時立即載入(xlink:actuate="onLoad")。

Returns

OdfSection

The newly created section object. / 新建立的區段物件。

AddTable(int, int)

Appends a table item to the end of the document body. 新增一個表格專案至文件本文結尾。

public OdfTable AddTable(int rows, int cols)

Parameters

rows int

The number of table rows. / 表格的列數。

cols int

The number of table columns. / 表格的欄數。

Returns

OdfTable

The newly created table object. / 新建立的表格物件。

AddTableIndex()

Adds a table index to the end of the document body. 新增表格索引至文件本文結尾。

public void AddTableIndex()

AddTableOfContents()

Short overload of AddTableOfContents that uses default values for all optional parameters and forwards to the full overload. 便利多載:AddTableOfContents 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfTableOfContents AddTableOfContents()

Returns

OdfTableOfContents

AddTableOfContents(string)

Short overload of AddTableOfContents that accepts title; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 title;其餘可選參數使用預設值並轉呼叫最長 AddTableOfContents 多載。

public OdfTableOfContents AddTableOfContents(string title)

Parameters

title string

Returns

OdfTableOfContents

AddTableOfContents(string, int)

Adds a table of contents item to the end of the document body. 新增目錄專案至文件本文結尾。

public OdfTableOfContents 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

OdfTableOfContents

The newly created table of contents object. / 新建立的目錄物件。

AddTrackedChange(string, string, DateTime)

Short overload of AddTrackedChange that accepts changeType, creator, and date; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 changeType、creator 與 date;其餘可選參數使用預設值並轉呼叫最長 AddTrackedChange 多載。

public string AddTrackedChange(string changeType, string creator, DateTime date)

Parameters

changeType string
creator string
date DateTime

Returns

string

AddTrackedChange(string, string, DateTime, OdfNode?)

Short overload of AddTrackedChange that accepts changeType, creator, date, and extraContent; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 changeType、creator、date 與 extraContent;其餘可選參數使用預設值並轉呼叫最長 AddTrackedChange 多載。

public string AddTrackedChange(string changeType, string creator, DateTime date, OdfNode? extraContent)

Parameters

changeType string
creator string
date DateTime
extraContent OdfNode

Returns

string

AddTrackedChange(string, string, DateTime, OdfNode?, string?)

Short overload of AddTrackedChange that accepts changeType, creator, date, extraContent, and originalStyleName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 changeType、creator、date、extraContent 與 originalStyleName;其餘可選參數使用預設值並轉呼叫最長 AddTrackedChange 多載。

public string AddTrackedChange(string changeType, string creator, DateTime date, OdfNode? extraContent, string? originalStyleName)

Parameters

changeType string
creator string
date DateTime
extraContent OdfNode
originalStyleName string

Returns

string

AddTrackedChange(string, string, DateTime, OdfNode?, string?, string?)

Adds a tracked change record. 新增一個追蹤修訂記錄。

public string AddTrackedChange(string changeType, string creator, DateTime date, OdfNode? extraContent, string? originalStyleName, string? targetFamily)

Parameters

changeType string

The change type ("insertion", "deletion", or "format-change"). / 修訂類型("insertion"、"deletion" 或 "format-change")。

creator string

The creator's name. / 建立者姓名。

date DateTime

The change time. / 修訂時間。

extraContent OdfNode

The change's extra content node. / 修訂的附加內容節點。

originalStyleName string

The original style name. / 原本的樣式名稱。

targetFamily string

The target style family name. / 目標樣式系列名稱。

Returns

string

The generated change identifier. / 產生的修訂識別碼。

AddUserFieldDeclaration(string, string, string)

Adds or updates a user field (template variable) declaration. 新增或更新一個使用者欄位(範本變數)宣告。

public void AddUserFieldDeclaration(string name, string valueType, string value)

Parameters

name string

The field name. / 欄位名稱。

valueType string

The value type (e.g. string, float, boolean, date, time). / 值類型(例如 stringfloatbooleandatetime)。

value string

The raw text of the field's value. / 欄位的值原文。

Exceptions

ArgumentException

Thrown when name or valueType is blank. / 當 namevalueType 為空白時擲出。

AppendList()

Short overload of AppendList that uses default values for all optional parameters and forwards to the full overload. 便利多載:AppendList 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfListBuilder AppendList()

Returns

OdfListBuilder

AppendList(string?)

Appends a list builder to the end of the text document body. 在文字文件本文的結尾,追加一個清單建構器。

public OdfListBuilder AppendList(string? styleName)

Parameters

styleName string

The optional list style name. / 選用的清單樣式名稱。

Returns

OdfListBuilder

The list builder. / 清單建構器。

ApplyCjkFontFallback()

Configures CJK (Chinese/Japanese/Korean) font fallback settings. 套用中日韓(CJK)字型遞補設定。

public void ApplyCjkFontFallback()

BeginParagraphPrebinding()

Short overload of BeginParagraphPrebinding that uses default values for all optional parameters and forwards to the full overload. 便利多載:BeginParagraphPrebinding 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfParagraphPrebindingWriter BeginParagraphPrebinding()

Returns

OdfParagraphPrebindingWriter

BeginParagraphPrebinding(string?)

Creates a batch paragraph writer pre-bound to the text body root node. 建立預先綁定至文字本文根節點的批次段落寫入器。

public OdfParagraphPrebindingWriter BeginParagraphPrebinding(string? styleName)

Parameters

styleName string

The optional paragraph style name, applied to all paragraphs added through this writer. / 選用的段落樣式名稱,會套用至此寫入器新增的所有段落。

Returns

OdfParagraphPrebindingWriter

The pre-bound paragraph writer. / 預先綁定的段落寫入器。

Builder()

Creates a new ODT text document fluent builder. 建立新的 ODT 文字文件 Fluent builder。

public static TextDocumentBuilder Builder()

Returns

TextDocumentBuilder

A new TextDocumentBuilder instance. / 新的 TextDocumentBuilder 執行個體。

ClearTemplateUserContent()

Clears template user content. 清除 Template User Content。

protected override void ClearTemplateUserContent()

Remarks

基底實作不做任何事;各文件種類(文字、試算表、簡報、繪圖)於對應的部分類別中覆寫, 依各自的內容模型清除使用者資料。

Create()

Creates a new ODT text document. 建立新的 ODT 文字文件。

public static TextDocument Create()

Returns

TextDocument

A new TextDocument instance. / 新的 TextDocument 執行個體。

CreateFromFlatDocument(FlatTextDocument)

Creates an equivalent ODT (ZIP package) text document from a FODT flat XML text document, with identical content. 從 FODT 扁平 XML 文字文件建立等價的 ODT(ZIP 封裝)文字文件,內容完全相同。

public static TextDocument CreateFromFlatDocument(FlatTextDocument document)

Parameters

document FlatTextDocument

The source FODT flat XML text document. / 來源 FODT 扁平 XML 文字文件。

Returns

TextDocument

The created TextDocument instance. / 建立完成的 TextDocument 執行個體。

CreateFromTemplate(TextTemplateDocument)

Short overload of CreateFromTemplate that accepts template; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 template;其餘可選參數使用預設值並轉呼叫最長 CreateFromTemplate 多載。

public static TextDocument CreateFromTemplate(TextTemplateDocument template)

Parameters

template TextTemplateDocument

Returns

TextDocument

CreateFromTemplate(TextTemplateDocument, bool)

Creates a new text document from the specified text template. 從指定的文字範本文件建立新的文字文件。

public static TextDocument CreateFromTemplate(TextTemplateDocument template, bool clearUserContent)

Parameters

template TextTemplateDocument

The text template document. / 文字範本文件。

clearUserContent bool

Whether to clear user content such as paragraphs in the template while keeping styles and master pages. / 是否清除範本中的段落等使用者內容,但保留樣式與母片頁面。

Returns

TextDocument

The created TextDocument instance. / 建立完成的 TextDocument 執行個體。

CreateFromWebDocument(TextWebDocument)

Creates an equivalent ODT text document from an OTH web template document, with identical content. 從 OTH 網頁範本文件建立等價的 ODT 文字文件,內容完全相同。

public static TextDocument CreateFromWebDocument(TextWebDocument document)

Parameters

document TextWebDocument

The source OTH web template document. / 來源 OTH 網頁範本文件。

Returns

TextDocument

The created TextDocument instance. / 建立完成的 TextDocument 執行個體。

DeleteNode(OdfNode)

Deletes the specified node and records a deletion change (if change tracking is enabled). 刪除指定的節點並記錄刪除修訂(若啟用修訂追蹤)。

public void DeleteNode(OdfNode node)

Parameters

node OdfNode

The ODF node to delete. / 要刪除的 ODF 節點。

ExtractFieldInfos()

Short overload of ExtractFieldInfos that uses default values for all optional parameters and forwards to the full overload. 便利多載:ExtractFieldInfos 的所有可選參數使用預設值並轉呼叫最長多載。

public IReadOnlyDictionary<string, OdfExtractedFieldInfo> ExtractFieldInfos()

Returns

IReadOnlyDictionary<string, OdfExtractedFieldInfo>

ExtractFieldInfos(string)

Short overload of ExtractFieldInfos that accepts startDelimiter; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 startDelimiter;其餘可選參數使用預設值並轉呼叫最長 ExtractFieldInfos 多載。

public IReadOnlyDictionary<string, OdfExtractedFieldInfo> ExtractFieldInfos(string startDelimiter)

Parameters

startDelimiter string

Returns

IReadOnlyDictionary<string, OdfExtractedFieldInfo>

ExtractFieldInfos(string, string)

Extracts detailed template field data, including the field source, back out of the document. 從文件中反向提取範本欄位詳細資料,包含欄位來源。

public IReadOnlyDictionary<string, OdfExtractedFieldInfo> ExtractFieldInfos(string startDelimiter, string endDelimiter)

Parameters

startDelimiter string

The field start delimiter, defaulting to [. / 欄位起始分隔符號,預設為 [

endDelimiter string

The field end delimiter, defaulting to ]. / 欄位結束分隔符號,預設為 ]

Returns

IReadOnlyDictionary<string, OdfExtractedFieldInfo>

A dictionary of detailed field data indexed by field name. / 依欄位名稱索引的欄位詳細資料字典。

ExtractFields()

Short overload of ExtractFields that uses default values for all optional parameters and forwards to the full overload. 便利多載:ExtractFields 的所有可選參數使用預設值並轉呼叫最長多載。

public IReadOnlyDictionary<string, string> ExtractFields()

Returns

IReadOnlyDictionary<string, string>

ExtractFields(string)

Short overload of ExtractFields that accepts startDelimiter; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 startDelimiter;其餘可選參數使用預設值並轉呼叫最長 ExtractFields 多載。

public IReadOnlyDictionary<string, string> ExtractFields(string startDelimiter)

Parameters

startDelimiter string

Returns

IReadOnlyDictionary<string, string>

ExtractFields(string, string)

Extracts template field values back out of the document, supporting text markers spanning text:span breaks, bookmark ranges, and ODF variable fields. 從文件中反向提取範本欄位值,支援跨 text:span 斷裂的文字標記、書籤範圍與 ODF 變數欄位。

public IReadOnlyDictionary<string, string> ExtractFields(string startDelimiter, string endDelimiter)

Parameters

startDelimiter string

The field start delimiter, defaulting to [. / 欄位起始分隔符號,預設為 [

endDelimiter string

The field end delimiter, defaulting to ]. / 欄位結束分隔符號,預設為 ]

Returns

IReadOnlyDictionary<string, string>

A dictionary of field values indexed by field name. / 依欄位名稱索引的欄位值字典。

Remarks

文字標記格式為 [Name]value[/Name]。若同名欄位重複出現,會保留文件中第一個值。

GetBookmarks()

Gets a summary list of all bookmarks in the document. 取得文件中所有書籤的摘要清單。

public IReadOnlyList<OdfBookmarkInfo> GetBookmarks()

Returns

IReadOnlyList<OdfBookmarkInfo>

The bookmark list, in document tree depth-first order. / 依文件樹深度優先順序排列的書籤清單。

GetCommentInfos()

Gets a summary list of all comments in the document. 取得文件中所有註解的摘要清單。

public IReadOnlyList<OdfCommentInfo> GetCommentInfos()

Returns

IReadOnlyList<OdfCommentInfo>

GetComments()

Gets the list of all comments in the document. 取得文件中所有註解的列表。

public List<OdfComment> GetComments()

Returns

List<OdfComment>

The list of comment objects. / 註解物件列表。

GetDefaultContentXml()

Gets the default content XML string. 取得預設的內容 XML 字串。

protected override string GetDefaultContentXml()

Returns

string

The content XML string. / 內容 XML 字串。

GetDefaultPageSetup()

Gets the default page setup. 取得預設的頁面設定。

public OdfPageSetup GetDefaultPageSetup()

Returns

OdfPageSetup

The default page setup object. / 預設頁面設定物件。

GetDefaultStylesXml()

Gets the default styles XML string. 取得預設的樣式 XML 字串。

protected override string GetDefaultStylesXml()

Returns

string

The styles XML string. / 樣式 XML 字串。

GetEndnotes()

Gets a summary list of all endnotes in the document. 取得文件中所有尾注的摘要清單。

public IReadOnlyList<OdfFootnoteInfo> GetEndnotes()

Returns

IReadOnlyList<OdfFootnoteInfo>

GetFootnotes()

Gets a summary list of all footnotes in the document. 取得文件中所有腳注的摘要清單。

public IReadOnlyList<OdfFootnoteInfo> GetFootnotes()

Returns

IReadOnlyList<OdfFootnoteInfo>

GetFormControls()

Gets all form controls in the document. 取得文件中所有表單控制項。

public IReadOnlyList<OdfFormControl> GetFormControls()

Returns

IReadOnlyList<OdfFormControl>

The list of controls; an empty list if there is no form. / 控制項清單;若無表單則回傳空清單。

Gets a summary list of all hyperlinks in the document. 取得文件中所有超連結的摘要清單。

public IReadOnlyList<OdfHyperlinkInfo> GetHyperlinks()

Returns

IReadOnlyList<OdfHyperlinkInfo>

GetIndexInfos()

Gets a summary list of all indexes in the document. 取得文件中所有索引的摘要清單。

public IReadOnlyList<OdfIndexInfo> GetIndexInfos()

Returns

IReadOnlyList<OdfIndexInfo>

GetIndexMarks()

Gets a summary list of all index marks in the document. 取得文件中所有索引標記的摘要清單。

public IReadOnlyList<OdfDocumentIndexMarkInfo> GetIndexMarks()

Returns

IReadOnlyList<OdfDocumentIndexMarkInfo>

GetIndexes()

Gets the list of all indexes in the document. 取得文件中所有索引的列表。

public List<OdfIndex> GetIndexes()

Returns

List<OdfIndex>

The list of index objects. / 包含索引物件的列表。

GetPageSetup(string)

Gets an editable page setup by master page style name. 依主頁面樣式名稱取得可編輯的頁面設定。

public OdfPageSetup GetPageSetup(string masterPageName)

Parameters

masterPageName string

The master page style name (e.g. Standard or Landscape). / 主頁面樣式名稱(例如 StandardLandscape)。

Returns

OdfPageSetup

The corresponding page setup object. / 對應的頁面設定物件。

Exceptions

ArgumentException

When no master page style with the specified name is found. / 找不到指定名稱的主頁面樣式時擲出。

GetPageSetups()

Gets a summary list of headers and footers for all master page styles. 取得所有主頁面樣式的頁首頁尾摘要清單。

public IReadOnlyList<OdfPageSetupInfo> GetPageSetups()

Returns

IReadOnlyList<OdfPageSetupInfo>

GetPageStyleNames()

Gets the list of all defined master page style names. 取得所有已定義的主頁面樣式名稱清單。

public IReadOnlyList<string> GetPageStyleNames()

Returns

IReadOnlyList<string>

GetReferenceMarks()

Gets a summary list of all reference marks in the document. 取得文件中所有參考標記的摘要清單。

public IReadOnlyList<OdfReferenceMarkInfo> GetReferenceMarks()

Returns

IReadOnlyList<OdfReferenceMarkInfo>

GetTableStructuralChanges()

Gets a summary list of all table structural changes (row/column insertions and deletions) in the document. 取得文件中所有表格結構修訂(列/欄插入刪除)的摘要清單。

public IReadOnlyList<OdfTableStructuralChangeInfo> GetTableStructuralChanges()

Returns

IReadOnlyList<OdfTableStructuralChangeInfo>

GetTrackedChanges()

Gets all tracked changes in the document. 取得文件中所有的追蹤修訂。

public IEnumerable<OdfTrackedChange> GetTrackedChanges()

Returns

IEnumerable<OdfTrackedChange>

The collection of tracked changes. / 追蹤修訂的集合。

GetUserFieldDeclarations()

Gets a summary list of all user field (template variable) declarations in the document. 取得文件中所有使用者欄位(範本變數)宣告的摘要清單。

public IReadOnlyList<OdfUserFieldDeclarationInfo> GetUserFieldDeclarations()

Returns

IReadOnlyList<OdfUserFieldDeclarationInfo>

The user field declaration summary list. / 使用者欄位宣告摘要清單。

ImportHtmlStyles(string)

Imports an HTML / CSS stylesheet, writing mappable rules into the ODT's styles.xml. 匯入 HTML / CSS 樣式表,並將可對應的規則寫入 ODT 的 styles.xml

public IReadOnlyDictionary<string, string> ImportHtmlStyles(string cssString)

Parameters

cssString string

The CSS stylesheet content to import. / 要匯入的 CSS 樣式表內容。

Returns

IReadOnlyDictionary<string, string>

A map from CSS selectors to the generated ODF style names. / CSS selector 與產生的 ODF 樣式名稱對照表。

InsertTableOfContents()

Short overload of InsertTableOfContents that uses default values for all optional parameters and forwards to the full overload. 便利多載:InsertTableOfContents 的所有可選參數使用預設值並轉呼叫最長多載。

public OdfTableOfContents InsertTableOfContents()

Returns

OdfTableOfContents

InsertTableOfContents(string)

Short overload of InsertTableOfContents that accepts title; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 title;其餘可選參數使用預設值並轉呼叫最長 InsertTableOfContents 多載。

public OdfTableOfContents InsertTableOfContents(string title)

Parameters

title string

Returns

OdfTableOfContents

InsertTableOfContents(string, int)

Inserts a table of contents at the end of the document and immediately updates it to auto-generate heading hyperlinks and outline content. 於文件結尾插入目錄,並立即更新以自動生成標題超連結與大綱內容。

public OdfTableOfContents InsertTableOfContents(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

OdfTableOfContents

The created and updated table of contents object. / 已建立且更新完成的目錄物件。

Load(Stream)

Loads an ODT text document from the specified stream. 從指定資料流載入 ODT 文字文件。

public static TextDocument Load(Stream stream)

Parameters

stream Stream

Returns

TextDocument

The loaded TextDocument instance. / 載入完成的 TextDocument 執行個體。

Exceptions

InvalidOperationException

When the specified document is not an ODT text document. / 當指定文件不是 ODT 文字文件時擲出。

Load(Stream, string?)

Short overload of Load that accepts stream and fileName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 fileName;其餘可選參數使用預設值並轉呼叫最長 Load 多載。

public static TextDocument Load(Stream stream, string? fileName)

Parameters

stream Stream
fileName string

Returns

TextDocument

Load(string)

Loads an ODT text document from the specified path. 從指定路徑載入 ODT 文字文件。

public static TextDocument Load(string path)

Parameters

path string

The ODT document path. / ODT 文件路徑。

Returns

TextDocument

The loaded TextDocument instance. / 載入完成的 TextDocument 執行個體。

Exceptions

InvalidOperationException

When the specified document is not an ODT text document. / 當指定文件不是 ODT 文字文件時擲出。

LoadAsync(Stream)

Asynchronously loads an ODT text document from the specified stream. 非同步從指定資料流載入 ODT 文字文件。

public static Task<TextDocument> LoadAsync(Stream stream)

Parameters

stream Stream

Returns

Task<TextDocument>

A task representing the asynchronous load operation, whose result is the loaded TextDocument. / 代表非同步載入作業的工作,其結果為載入完成的 TextDocument

LoadAsync(Stream, string?)

Short overload of LoadAsync that accepts stream and fileName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream 與 fileName;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<TextDocument> LoadAsync(Stream stream, string? fileName)

Parameters

stream Stream
fileName string

Returns

Task<TextDocument>

LoadAsync(Stream, string?, CancellationToken)

Short overload of LoadAsync that accepts stream, fileName, and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stream、fileName 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<TextDocument> LoadAsync(Stream stream, string? fileName, CancellationToken cancellationToken)

Parameters

stream Stream
fileName string
cancellationToken CancellationToken

Returns

Task<TextDocument>

LoadAsync(Stream, CancellationToken)

Asynchronously loads the document from a stream with a cancellation token. 以取消語彙基元非同步從資料流載入文件。

public static Task<TextDocument> LoadAsync(Stream stream, CancellationToken cancellationToken)

Parameters

stream Stream

The document stream. / 文件資料流。

cancellationToken CancellationToken

The cancellation token. / 取消語彙基元。

Returns

Task<TextDocument>

A task whose result is the loaded document. / 代表非同步載入作業的工作,其結果為載入完成的文件。

LoadAsync(string)

Asynchronously loads an ODT text document from the specified path. 非同步從指定路徑載入 ODT 文字文件。

public static Task<TextDocument> LoadAsync(string path)

Parameters

path string

Returns

Task<TextDocument>

A task representing the asynchronous load operation, whose result is the loaded TextDocument. / 代表非同步載入作業的工作,其結果為載入完成的 TextDocument

Remarks

若 已請求取消,作業會立即以 OperationCanceledException 結束; 否則會在 ZIP 解壓與封裝初始化期間協作檢查取消語彙。

LoadAsync(string, CancellationToken)

Short overload of LoadAsync that accepts path and cancellationToken; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 path 與 cancellationToken;其餘可選參數使用預設值並轉呼叫最長 LoadAsync 多載。

public static Task<TextDocument> LoadAsync(string path, CancellationToken cancellationToken)

Parameters

path string
cancellationToken CancellationToken

Returns

Task<TextDocument>

MailMerge(IEnumerable<IReadOnlyDictionary<string, object?>>)

Performs a batch mail merge using a collection of dictionary records, producing an independent document copy for each record. 以字典記錄集合執行批次郵件合併,每筆記錄產生獨立的文件副本。

public IReadOnlyList<TextDocument> MailMerge(IEnumerable<IReadOnlyDictionary<string, object?>> records)

Parameters

records IEnumerable<IReadOnlyDictionary<string, object>>

The collection of dictionary records, whose keys correspond to merge field names. / 字典記錄集合,Key 對應合併欄位名稱。

Returns

IReadOnlyList<TextDocument>

A merged TextDocument for each record; the caller is responsible for disposing them. / 每筆記錄對應一個已合併的 TextDocument;呼叫端負責 Dispose。

MailMerge(IReadOnlyDictionary<string, object?>)

Performs a mail merge using a dictionary data source, whose keys correspond to the merge field names in the document. 以字典資料來源執行郵件合併,Key 對應文件中的合併欄位名稱。

public void MailMerge(IReadOnlyDictionary<string, object?> dataSource)

Parameters

dataSource IReadOnlyDictionary<string, object>

The data dictionary keyed by field name. / 以欄位名稱為 Key 的資料字典。

MailMerge<T>(IEnumerable<T>)

Performs a batch mail merge using a collection of strongly typed records, producing an independent document copy for each record. 以強型別記錄集合執行批次郵件合併,每筆記錄產生獨立的文件副本。

public IReadOnlyList<TextDocument> MailMerge<T>(IEnumerable<T> records) where T : notnull

Parameters

records IEnumerable<T>

The collection of data records. / 資料記錄集合。

Returns

IReadOnlyList<TextDocument>

A merged TextDocument for each record; the caller is responsible for disposing them. / 每筆記錄對應一個已合併的 TextDocument;呼叫端負責 Dispose。

Type Parameters

T

The record type; property names correspond to the merge field names in the document. / 記錄型別;屬性名稱對應文件中的合併欄位名稱。

MailMerge<T>(T)

Performs a mail merge using a strongly typed data source object, whose property names correspond to the merge field names in the document. 以強型別資料來源物件執行郵件合併,屬性名稱對應文件中的合併欄位名稱。

public void MailMerge<T>(T dataSource) where T : notnull

Parameters

dataSource T

The merge data source object. / 合併資料來源物件。

Type Parameters

T

The data source type. / 資料來源型別。

MergeContentNodes(OdfDocument, OdfMergeOptions, Dictionary<string, string>)

Merges the content nodes of a source document into the current document. 合併來源文件與目前文件的內容節點。

protected override void MergeContentNodes(OdfDocument sourceDoc, OdfMergeOptions options, Dictionary<string, string> renameMap)

Parameters

sourceDoc OdfDocument

The source OdfDocument. / 來源 OdfDocument 文件。

options OdfMergeOptions

The merge options. / 合併設定選項。

renameMap Dictionary<string, string>

The dictionary mapping renamed style names. / 變更樣式名稱的對照字典。

OptimizeMedia(double, int)

Short overload of OptimizeMedia that accepts maxDpi and jpegQuality; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 maxDpi 與 jpegQuality;其餘可選參數使用預設值並轉呼叫最長 OptimizeMedia 多載。

public int OptimizeMedia(double maxDpi, int jpegQuality)

Parameters

maxDpi double
jpegQuality int

Returns

int

OptimizeMedia(double, int, OdfMediaOptimizer?)

Optimizes picture media in the document, synchronizing the package paths and draw:image references. 最佳化文件中的圖片媒體,並同步更新封裝路徑與 draw:image 參照。

public int OptimizeMedia(double maxDpi, int jpegQuality, OdfMediaOptimizer? optimizer)

Parameters

maxDpi double

The target maximum DPI, passed to optimizer so the image backend can decide whether resampling is needed. / 目標最大 DPI;會傳入 optimizer 供影像後端判斷是否需要重採樣。

jpegQuality int

The JPEG output quality, ranging from 1 to 100. / JPEG 輸出品質,範圍為 1 至 100。

optimizer OdfMediaOptimizer

The delegate that actually performs image resampling or transcoding; returning null keeps the original image. / 實際執行影像重採樣或轉碼的委派;回傳 null 時保留原圖。

Returns

int

The number of updated media items. / 已更新的媒體項目數量。

Exceptions

ArgumentOutOfRangeException

Thrown when jpegQuality is not between 1 and 100. / 當 jpegQuality 不在 1 到 100 之間時擲出。

RecordTrackedChange(string)

Short overload of RecordTrackedChange that accepts changeType; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 changeType;其餘可選參數使用預設值並轉呼叫最長 RecordTrackedChange 多載。

public string RecordTrackedChange(string changeType)

Parameters

changeType string

Returns

string

RecordTrackedChange(string, OdfNode?)

Short overload of RecordTrackedChange that accepts changeType and extraContent; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 changeType 與 extraContent;其餘可選參數使用預設值並轉呼叫最長 RecordTrackedChange 多載。

public string RecordTrackedChange(string changeType, OdfNode? extraContent)

Parameters

changeType string
extraContent OdfNode

Returns

string

RecordTrackedChange(string, OdfNode?, string?)

Short overload of RecordTrackedChange that accepts changeType, extraContent, and originalStyleName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 changeType、extraContent 與 originalStyleName;其餘可選參數使用預設值並轉呼叫最長 RecordTrackedChange 多載。

public string RecordTrackedChange(string changeType, OdfNode? extraContent, string? originalStyleName)

Parameters

changeType string
extraContent OdfNode
originalStyleName string

Returns

string

RecordTrackedChange(string, OdfNode?, string?, string?)

Records change tracking information. 記錄修訂追蹤資訊。

public string RecordTrackedChange(string changeType, OdfNode? extraContent, string? originalStyleName, string? targetFamily)

Parameters

changeType string

The change type. / 修訂類型。

extraContent OdfNode

The change's extra content node. / 修訂的附加內容節點。

originalStyleName string

The original style name. / 原本的樣式名稱。

targetFamily string

The target style family name. / 目標樣式系列名稱。

Returns

string

The generated change identifier. / 產生的修訂識別碼。

RejectAllChanges()

Rejects all tracked changes in the document. 拒絕文件中所有的追蹤修訂。

public void RejectAllChanges()

RejectAllTrackedChanges()

Rejects all tracked changes in the document. 拒絕文件中所有的追蹤修訂。

public void RejectAllTrackedChanges()

RejectChange(string)

Rejects the specified tracked change. 拒絕指定的追蹤修訂。

public void RejectChange(string changeId)

Parameters

changeId string

The change identifier. / 修訂識別碼。

ReplaceText(string, string)

Searches for the specified text and replaces it with new text. 搜尋指定文字並替換為新文字。

public void ReplaceText(string search, string replacement)

Parameters

search string
replacement string

ReplaceText(string, string, Action<OdfTextRun>?)

Full overload of ReplaceText that accepts search, replacement, and styleAction. ReplaceText 完整多載:接受 search、replacement 與 styleAction。

public void ReplaceText(string search, string replacement, Action<OdfTextRun>? styleAction)

Parameters

search string
replacement string
styleAction Action<OdfTextRun>

ReplaceText(Regex, string)

Searches for text using a regular expression and replaces it with new text. 以規則運算式搜尋文字並替換為新文字。

public void ReplaceText(Regex regex, string replacement)

Parameters

regex Regex
replacement string

ReplaceText(Regex, string, Action<OdfTextRun>?)

Short overload of ReplaceText that accepts regex, replacement, and styleAction; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 regex、replacement 與 styleAction;其餘可選參數使用預設值並轉呼叫最長 ReplaceText 多載。

public void ReplaceText(Regex regex, string replacement, Action<OdfTextRun>? styleAction)

Parameters

regex Regex
replacement string
styleAction Action<OdfTextRun>

SetUserFieldValue(string, string)

Sets the value of an existing user field (template variable) declaration. 設定既有使用者欄位(範本變數)宣告的值。

public bool SetUserFieldValue(string name, string value)

Parameters

name string

The field name. / 欄位名稱。

value string

The raw text of the value to set. / 要設定的值原文。

Returns

bool

true if set successfully; false if no declaration with the given name was found. / 若成功設定則為 true;找不到對應名稱的欄位宣告時為 false

Exceptions

ArgumentException

Thrown when name is blank. / 當 name 為空白時擲出。

ShiftHeadingOutlineLevels(int)

Shifts the outline level of all headings in the document (including headings nested within sections) by the specified amount. 將文件中所有標題(包含區段內巢狀標題)的大綱階層整體位移指定量。

public void ShiftHeadingOutlineLevels(int offset)

Parameters

offset int

The shift amount; a positive value demotes (increases the number), a negative value promotes. The result is clamped to a minimum of 1. / 位移量;正值表示降階(數字變大),負值表示升階。結果會限制最小為 1。

Remarks

適用於將子文件併入主控文件前,調整其標題大綱階層以接續主控文件本身的階層結構 (例如主控文件已有第 1 階層的「上篇」標題,子文件章節標題需位移為第 2 階層才能正確巢狀)。

StreamingMailMerge(Stream, IDictionary<string, object?>)

Performs a streaming, low-residency mail merge using the current text document as a template, writing the result to the target stream. 以串流、低常駐記憶體的方式,將目前文字文件作為範本進行郵件合併,並將結果輸出至目標串流。

public void StreamingMailMerge(Stream outputStream, IDictionary<string, object?> dataSource)

Parameters

outputStream Stream

The target output file stream. / 輸出目標檔案串流。

dataSource IDictionary<string, object>

The merge data dictionary, whose keys correspond to merge field names in the template. / 套印資料字典,Key 對應範本中的合併欄位名稱。

Remarks

Prefer StreamingMailMergeAsync(Stream, IDictionary<string, object?>, CancellationToken) in server environments to avoid blocking request threads. 在 ASP.NET Core 等伺服器環境中,請優先使用 StreamingMailMergeAsync(Stream, IDictionary<string, object?>, CancellationToken) 以避免阻塞要求執行緒。

StreamingMailMerge(string, Stream, IDictionary<string, object?>)

Performs a streaming, low-residency mail merge by loading a template text document from the specified path, writing the result to the target stream. 以串流、低常駐記憶體的方式,載入指定路徑的範本文字文件進行郵件合併,並將結果輸出至目標串流。

public static void StreamingMailMerge(string templatePath, Stream outputStream, IDictionary<string, object?> dataSource)

Parameters

templatePath string

The template text document path. / 範本文字文件路徑。

outputStream Stream

The target output file stream. / 輸出目標檔案串流。

dataSource IDictionary<string, object>

The merge data dictionary, whose keys correspond to merge field names in the template. / 套印資料字典,Key 對應範本中的合併欄位名稱。

Remarks

Prefer ApplyTemplateAsync(Stream, Stream, IDictionary<string, object?>, CancellationToken) in server environments to avoid blocking request threads. 在 ASP.NET Core 等伺服器環境中,請優先使用 ApplyTemplateAsync(Stream, Stream, IDictionary<string, object?>, CancellationToken) 以避免阻塞要求執行緒。

StreamingMailMergeAsync(Stream, IDictionary<string, object?>)

Short overload of StreamingMailMergeAsync that accepts outputStream; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 outputStream;其餘可選參數使用預設值並轉呼叫最長 StreamingMailMergeAsync 多載。

public Task StreamingMailMergeAsync(Stream outputStream, IDictionary<string, object?> dataSource)

Parameters

outputStream Stream
dataSource IDictionary<string, object>

Returns

Task

StreamingMailMergeAsync(Stream, IDictionary<string, object?>, CancellationToken)

Performs a streaming, low-residency mail merge using the current text document as a template, writing the result to the target stream. 以串流、低常駐記憶體的方式,將目前文字文件作為範本進行郵件合併,並將結果輸出至目標串流。

public Task StreamingMailMergeAsync(Stream outputStream, IDictionary<string, object?> dataSource, CancellationToken cancellationToken)

Parameters

outputStream Stream

The target output file stream. / 輸出目標檔案串流。

dataSource IDictionary<string, object>

The merge data dictionary, whose keys correspond to merge field names in the template. / 套印資料字典,Key 對應範本中的合併欄位名稱。

cancellationToken CancellationToken

The cancellation token. / 取消語彙基元。

Returns

Task

A task representing the asynchronous merge operation. / 代表非同步合併作業的工作。

Remarks

此方法會將目前文件儲存,並從其封裝包的底層資料流中以 SAX 流式讀寫重構輸出,不會載入完整 DOM 樹至記憶體中。

TrackFormatChange(OdfNode, string)

Tracks a format change. 追蹤格式變更。

public void TrackFormatChange(OdfNode node, string family)

Parameters

node OdfNode

The ODF node where the change occurred. / 發生變更的 ODF 節點。

family string

The style family name. / 樣式系列名稱。

UpdateIndexes()

Regenerates the content of all indexes in the document. 重新產生文件中所有索引的內容。

public void UpdateIndexes()