Class OdfParagraph
Represents a paragraph in a text document. 表示文字文件中的段落。
public class OdfParagraph
- Inheritance
-
OdfParagraph
- Derived
- Inherited Members
Fields
Doc
The owning text document. 取得所屬的文字文件。
protected readonly TextDocument Doc
Field Value
Properties
FontName
Gets or sets the paragraph's Western font name. 取得或設定段落的西文字型名稱。
public string? FontName { get; set; }
Property Value
FontNameAsian
Gets or sets the paragraph's East Asian (CJK) font name. 取得或設定段落的東亞(中日韓)字型名稱。
public string? FontNameAsian { get; set; }
Property Value
FontNameComplex
Gets or sets the paragraph's complex script font name. 取得或設定段落的複雜文字字型名稱。
public string? FontNameComplex { get; set; }
Property Value
FontSize
Gets or sets the paragraph's Western font size. 取得或設定段落的西文字型大小。
public string? FontSize { get; set; }
Property Value
FontSizeAsian
Gets or sets the paragraph's East Asian (CJK) font size. 取得或設定段落的東亞(中日韓)字型大小。
public string? FontSizeAsian { get; set; }
Property Value
FontSizeComplex
Gets or sets the paragraph's complex script font size. 取得或設定段落的複雜文字字型大小。
public string? FontSizeComplex { get; set; }
Property Value
HorizontalAlignment
Gets or sets the paragraph's horizontal alignment. 取得或設定段落的水平對齊方式。
public string? HorizontalAlignment { get; set; }
Property Value
Runs
Gets all text runs of this paragraph. Accessing it automatically wraps direct child text nodes in span nodes. 取得此段落的所有文字片段(Runs)。存取時會自動將直屬的文字節點分裂包裝為 span 節點。
public IEnumerable<OdfTextRun> Runs { get; }
Property Value
Style
Gets the high-level style configuration proxy facade for this paragraph. 取得此段落的高階樣式設定代理 Facade。
public OdfParagraphStyleProxy Style { get; }
Property Value
StyleName
Gets or sets the paragraph's style name. 取得或設定段落的樣式名稱。
public string? StyleName { get; set; }
Property Value
TextContent
Gets or sets the paragraph's text content. 取得或設定段落的文字內容。
public string TextContent { get; set; }
Property Value
TextIndent
Gets or sets the paragraph's first-line indent (maps to the fo:text-indent attribute).
取得或設定段落首行縮排(對應 fo:text-indent 屬性)。
public string? TextIndent { get; set; }
Property Value
WritingMode
Gets or sets the paragraph's writing mode. 取得或設定段落的書寫模式。
public OdfWritingMode WritingMode { get; set; }
Property Value
Methods
AddAlphabeticalIndexMark(string)
Short overload of AddAlphabeticalIndexMark that accepts stringValue; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stringValue;其餘可選參數使用預設值並轉呼叫最長 AddAlphabeticalIndexMark 多載。
public OdfAlphabeticalIndexMark AddAlphabeticalIndexMark(string stringValue)
Parameters
stringValuestring
Returns
AddAlphabeticalIndexMark(string, string?)
Short overload of AddAlphabeticalIndexMark that accepts stringValue and key1; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 stringValue 與 key1;其餘可選參數使用預設值並轉呼叫最長 AddAlphabeticalIndexMark 多載。
public OdfAlphabeticalIndexMark AddAlphabeticalIndexMark(string stringValue, string? key1)
Parameters
Returns
AddAlphabeticalIndexMark(string, string?, string?)
Adds an alphabetical index mark in the paragraph. 在段落中新增字母索引標記。
public OdfAlphabeticalIndexMark AddAlphabeticalIndexMark(string stringValue, string? key1, string? key2)
Parameters
stringValuestringThe index string value. / 索引字串值。
key1stringThe primary key. / 主要鍵值。
key2stringThe secondary key. / 次要鍵值。
Returns
AddAuthorField()
Adds an author name field in the paragraph. 在段落中新增作者名稱欄位。
public void AddAuthorField()
AddBibliographyMark(string, string, string, string, string)
Adds a bibliography mark in the paragraph. 在段落中新增文獻標記。
public OdfBibliographyMark AddBibliographyMark(string identifier, string bibliographyType, string author, string title, string year)
Parameters
identifierstringThe bibliography mark identifier. / 文獻標記識別碼。
bibliographyTypestringThe bibliography type. / 文獻類型。
authorstringThe bibliography author. / 文獻作者。
titlestringThe bibliography title. / 文獻標題。
yearstringThe publication year. / 出版年份。
Returns
AddBookmark(string)
Adds a bookmark in the paragraph. 在段落中新增書籤。
public void AddBookmark(string name)
Parameters
namestringThe bookmark name. / 書籤名稱。
AddBookmarkReferenceField(string)
Short overload of AddBookmarkReferenceField that accepts bookmarkName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 bookmarkName;其餘可選參數使用預設值並轉呼叫最長 AddBookmarkReferenceField 多載。
public void AddBookmarkReferenceField(string bookmarkName)
Parameters
bookmarkNamestring
AddBookmarkReferenceField(string, string)
Adds a bookmark reference field in the paragraph. 在段落中新增書籤參照欄位。
public void AddBookmarkReferenceField(string bookmarkName, string referenceFormat)
Parameters
bookmarkNamestringThe bookmark name. / 書籤名稱。
referenceFormatstringThe reference format; defaults to "text". / 參照格式,預設為 "text"。
AddChapterField()
Adds a chapter field in the paragraph. 在段落中新增章節欄位。
public void AddChapterField()
AddComment(OdfComment)
Adds a comment in the paragraph. 在段落中新增批注。
public void AddComment(OdfComment comment)
Parameters
commentOdfCommentThe comment object. / 批注物件。
AddDatabaseDisplayField(string, string)
Short overload of AddDatabaseDisplayField that accepts tableName and columnName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 tableName 與 columnName;其餘可選參數使用預設值並轉呼叫最長 AddDatabaseDisplayField 多載。
public void AddDatabaseDisplayField(string tableName, string columnName)
Parameters
AddDatabaseDisplayField(string, string, string?)
Short overload of AddDatabaseDisplayField that accepts tableName, columnName, and tableType; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 tableName、columnName 與 tableType;其餘可選參數使用預設值並轉呼叫最長 AddDatabaseDisplayField 多載。
public void AddDatabaseDisplayField(string tableName, string columnName, string? tableType)
Parameters
AddDatabaseDisplayField(string, string, string?, string?)
Adds a database field display field (text:database-display) in the paragraph, used for mail merge or report content bound to a table column.
在段落中新增資料庫欄位顯示欄位(text:database-display),用於合併列印或報表內容綁定資料表欄位。
public void AddDatabaseDisplayField(string tableName, string columnName, string? tableType, string? databaseName)
Parameters
tableNamestringThe table, query, or command name. / 資料表、查詢或指令名稱。
columnNamestringThe column name to display. / 要顯示的欄位名稱。
tableTypestringThe data source type, either "table", "query", or "command". / 資料來源類型,可為 "table"、"query" 或 "command"。
databaseNamestringThe database connection name. / 資料庫連線名稱。
AddDatabaseNextField(string)
Short overload of AddDatabaseNextField that accepts tableName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 tableName;其餘可選參數使用預設值並轉呼叫最長 AddDatabaseNextField 多載。
public void AddDatabaseNextField(string tableName)
Parameters
tableNamestring
AddDatabaseNextField(string, string?)
Short overload of AddDatabaseNextField that accepts tableName and tableType; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 tableName 與 tableType;其餘可選參數使用預設值並轉呼叫最長 AddDatabaseNextField 多載。
public void AddDatabaseNextField(string tableName, string? tableType)
Parameters
AddDatabaseNextField(string, string?, string?)
Short overload of AddDatabaseNextField that accepts tableName, tableType, and databaseName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 tableName、tableType 與 databaseName;其餘可選參數使用預設值並轉呼叫最長 AddDatabaseNextField 多載。
public void AddDatabaseNextField(string tableName, string? tableType, string? databaseName)
Parameters
AddDatabaseNextField(string, string?, string?, string?)
Adds a database next record field (text:database-next) in the paragraph, used for advancing records in mail merge or reports.
在段落中新增資料庫下一筆記錄欄位(text:database-next),用於合併列印或報表的逐筆換行。
public void AddDatabaseNextField(string tableName, string? tableType, string? databaseName, string? condition)
Parameters
tableNamestringThe table, query, or command name. / 資料表、查詢或指令名稱。
tableTypestringThe data source type, either "table", "query", or "command". / 資料來源類型,可為 "table"、"query" 或 "command"。
databaseNamestringThe database connection name. / 資料庫連線名稱。
conditionstringThe condition expression evaluated before advancing. / 換行前的判斷條件式。
AddDateField()
Adds a date field in the paragraph. 在段落中新增日期欄位。
public void AddDateField()
AddEndnote(string, string)
Inserts an endnote in the paragraph. 在段落中插入尾注。
public void AddEndnote(string citation, string bodyText)
Parameters
citationstringThe endnote citation marker. / 尾注引用標記。
bodyTextstringThe endnote body content. / 尾注本文內容。
AddFloatingTextBox(OdfLength, OdfLength, OdfLength, OdfLength)
Short overload of AddFloatingTextBox that accepts x, y, width, and height; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 x、y、width 與 height;其餘可選參數使用預設值並轉呼叫最長 AddFloatingTextBox 多載。
public OdfFloatingTextBox AddFloatingTextBox(OdfLength x, OdfLength y, OdfLength width, OdfLength height)
Parameters
Returns
AddFloatingTextBox(OdfLength, OdfLength, OdfLength, OdfLength, OdfAnchorType)
Short overload of AddFloatingTextBox that accepts x, y, width, height, and anchorType; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 x、y、width、height 與 anchorType;其餘可選參數使用預設值並轉呼叫最長 AddFloatingTextBox 多載。
public OdfFloatingTextBox AddFloatingTextBox(OdfLength x, OdfLength y, OdfLength width, OdfLength height, OdfAnchorType anchorType)
Parameters
xOdfLengthyOdfLengthwidthOdfLengthheightOdfLengthanchorTypeOdfAnchorType
Returns
AddFloatingTextBox(OdfLength, OdfLength, OdfLength, OdfLength, OdfAnchorType, OdfTextWrap)
Adds a floating text box in the paragraph. 在段落中新增浮動文字框。
public OdfFloatingTextBox AddFloatingTextBox(OdfLength x, OdfLength y, OdfLength width, OdfLength height, OdfAnchorType anchorType, OdfTextWrap wrap)
Parameters
xOdfLengthThe X-axis position. / X 軸座標位置。
yOdfLengthThe Y-axis position. / Y 軸座標位置。
widthOdfLengthThe text box width. / 文字框寬度。
heightOdfLengthThe text box height. / 文字框高度。
anchorTypeOdfAnchorTypeThe anchor type. / 錨定類型。
wrapOdfTextWrapThe text wrap mode. / 文字環繞方式。
Returns
- OdfFloatingTextBox
The newly created floating text box. / 新建立的浮動文字框。
AddFootnote(string, string)
Inserts a footnote in the paragraph. 在段落中插入腳注。
public void AddFootnote(string citation, string bodyText)
Parameters
citationstringThe footnote citation marker. / 腳注引用標記。
bodyTextstringThe footnote body content. / 腳注本文內容。
AddFormula(string)
Adds a formula object (MathML) in the paragraph. 在段落中新增公式物件(MathML)。
public void AddFormula(string mathMlXmlString)
Parameters
mathMlXmlStringstringThe MathML XML string. / MathML XML 字串。
AddHtmlFragment(string)
Parses and adds an HTML fragment in the paragraph. 在段落中解析並新增 HTML 片段。
public void AddHtmlFragment(string html)
Parameters
htmlstringThe HTML fragment string. / HTML 字串片段。
AddHyperlink(string, string)
Adds a hyperlink in the paragraph. 在段落中新增超連結。
public void AddHyperlink(string url, string text)
Parameters
AddImage(string, OdfLength, OdfLength)
Short overload of AddImage that accepts packagePath, width, and height; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 packagePath、width 與 height;其餘可選參數使用預設值並轉呼叫最長 AddImage 多載。
public OdfImage AddImage(string packagePath, OdfLength width, OdfLength height)
Parameters
Returns
AddImage(string, OdfLength, OdfLength, string?)
Adds an image in the paragraph. 在段落中新增圖片。
public OdfImage AddImage(string packagePath, OdfLength width, OdfLength height, string? name)
Parameters
packagePathstringThe image's path within the package. / 圖片在封裝包內的路徑。
widthOdfLengthThe image width. / 圖片寬度。
heightOdfLengthThe image height. / 圖片高度。
namestringThe image name. / 圖片名稱。
Returns
AddLineBreak()
Adds a line break in the paragraph. 在段落中新增換行符號。
public void AddLineBreak()
AddPageCountField()
Adds a page count field in the paragraph. 在段落中新增總頁數欄位。
public void AddPageCountField()
AddPageNumberField()
Adds a page number field in the paragraph. 在段落中新增頁碼欄位。
public void AddPageNumberField()
AddReferenceField(string)
Adds a reference entry field in the paragraph. 在段落中新增參考專案欄位。
public void AddReferenceField(string refName)
Parameters
refNamestringThe reference entry name. / 參考專案名稱。
AddReferenceMark(string)
Adds a reference mark in the paragraph. 在段落中新增參考標記。
public void AddReferenceMark(string name)
Parameters
namestringThe reference mark name. / 參考標記名稱。
AddRuby(string, string)
Adds a ruby (phonetic) annotation in the paragraph. 在段落中新增旁註標記(注音)。
public OdfRuby AddRuby(string baseText, string rubyText)
Parameters
Returns
AddSequenceField(string)
Short overload of AddSequenceField that accepts name; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 name;其餘可選參數使用預設值並轉呼叫最長 AddSequenceField 多載。
public void AddSequenceField(string name)
Parameters
namestring
AddSequenceField(string, string)
Adds a sequence number field in the paragraph. 在段落中新增序號欄位。
public void AddSequenceField(string name, string numFormat)
Parameters
AddSequenceRefField(string)
Short overload of AddSequenceRefField that accepts sequenceName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 sequenceName;其餘可選參數使用預設值並轉呼叫最長 AddSequenceRefField 多載。
public void AddSequenceRefField(string sequenceName)
Parameters
sequenceNamestring
AddSequenceRefField(string, string)
Adds a sequence cross-reference field in the paragraph. 在段落中新增序號交互參照欄位。
public void AddSequenceRefField(string sequenceName, string referenceFormat)
Parameters
sequenceNamestringThe sequence field name. / 序號欄位名稱。
referenceFormatstringThe reference format; defaults to "value". / 參照格式,預設為 "value"。
AddSoftPageBreak()
Adds a soft page break in the paragraph. 在段落中新增軟分頁符號。
public void AddSoftPageBreak()
AddSpace()
Short overload of AddSpace that uses default values for all optional parameters and forwards to the full overload. 便利多載:AddSpace 的所有可選參數使用預設值並轉呼叫最長多載。
public void AddSpace()
AddSpace(int)
Adds the specified number of space entries in the paragraph. 在段落中新增指定數量的空格專案。
public void AddSpace(int count)
Parameters
countintThe number of spaces. / 空格數量。
AddTab()
Adds a tab character in the paragraph. 在段落中新增定位點(Tab)字元。
public void AddTab()
AddText(string, OdfTextFontFallbackOptions)
Adds text using the specified font fallback options. 使用指定的字型遞補選項新增文字。
public IReadOnlyList<OdfTextRun> AddText(string text, OdfTextFontFallbackOptions options)
Parameters
textstringThe text content to add. / 要新增的文字內容。
optionsOdfTextFontFallbackOptionsThe font fallback options. / 字型遞補選項。
Returns
- IReadOnlyList<OdfTextRun>
The collection of added text runs. / 新增的文字片段集合。
AddTextRun(string)
Adds a text run at the end of the paragraph. 在段落結尾新增一個文字片段。
public OdfTextRun AddTextRun(string text)
Parameters
textstringThe text content to add. / 要新增的文字內容。
Returns
- OdfTextRun
The created text run object. / 建立的文字片段物件。
AddTimeField()
Adds a time field in the paragraph. 在段落中新增時間欄位。
public void AddTimeField()
AddVariableGetField(string)
Gets a variable field value in the paragraph. 在段落中取得變數欄位值。
public void AddVariableGetField(string name)
Parameters
namestringThe variable name. / 變數名稱。
AddVariableSetField(string, string)
Sets a variable field value in the paragraph. 在段落中設定變數欄位值。
public void AddVariableSetField(string name, string value)
Parameters
AppendHtml(string)
Parses and appends an inline HTML rich-text fragment at the end of the paragraph. 在段落結尾解析並追加 HTML 行內富文字片段。
public OdfParagraph AppendHtml(string html)
Parameters
htmlstringThe inline HTML fragment to parse. / 要解析的 HTML 行內片段。
Returns
- OdfParagraph
The current paragraph, for chained calls. / 目前段落,方便鏈式呼叫。
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 within the paragraph. 在段落內追加一個清單建構器。
public OdfListBuilder AppendList(string? styleName)
Parameters
styleNamestringThe optional list style name. / 選用的清單樣式名稱。
Returns
- OdfListBuilder
The list builder. / 清單建構器。
AppendMarkdown(string)
Parses and appends an inline Markdown rich-text fragment at the end of the paragraph. 在段落結尾解析並追加 Markdown 行內富文字片段。
public OdfParagraph AppendMarkdown(string markdown)
Parameters
markdownstringThe inline Markdown text to parse. / 要解析的 Markdown 行內文字。
Returns
- OdfParagraph
The current paragraph, for chained calls. / 目前段落,方便鏈式呼叫。
AppendText()
Gets the paragraph's inline rich-text builder, supporting chained style configuration. 取得段落的行內富文本建構器,支援鏈式樣式設定。
public InlineTextBuilder AppendText()
Returns
- InlineTextBuilder
The inline rich-text builder. / 行內富文本建構器。
BreakPageBefore()
Short overload of BreakPageBefore that uses default values for all optional parameters and forwards to the full overload. 便利多載:BreakPageBefore 的所有可選參數使用預設值並轉呼叫最長多載。
public void BreakPageBefore()
BreakPageBefore(string?)
Short overload of BreakPageBefore that accepts masterPageName; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 masterPageName;其餘可選參數使用預設值並轉呼叫最長 BreakPageBefore 多載。
public void BreakPageBefore(string? masterPageName)
Parameters
masterPageNamestring
BreakPageBefore(string?, int?)
Inserts a page break before this paragraph, optionally switching the page style. 在此段落前插入分頁符號,並可選擇性地切換頁面樣式。
public void BreakPageBefore(string? masterPageName, int? pageNumber)
Parameters
masterPageNamestringThe master page style name to switch to; null means only inserting the page break. / 要切換的主頁面樣式名稱;null 表示只插入分頁。
pageNumberint?The new starting page number; null means continuing. / 新頁碼起始值;null 表示繼續。
ClearRuns()
Removes all text runs within this paragraph (removes all span nodes). 清除此段落內的所有文字片段(移除所有的 span 節點)。
public void ClearRuns()
Delete()
Deletes this paragraph. 刪除此段落。
public void Delete()
EnableAutoNumbering(string)
Enables automatic numbering style for this outline paragraph. 啟用此大綱段落的自動編號樣式。
public OdfParagraph EnableAutoNumbering(string styleName)
Parameters
styleNamestringThe list style name to use or create. / 要使用或建立的清單樣式名稱。
Returns
- OdfParagraph
The current paragraph, for chained calls. / 目前段落,供鏈式呼叫使用。
ReplaceText(string, string)
Searches this paragraph for the specified text and replaces it with new text, while preserving the original style structure of unmatched segments. 在此段落內搜尋指定文字並替換為新文字,同時保留未命中區段的原始樣式結構。
public void ReplaceText(string search, string replacement)
Parameters
searchstringThe keyword to search for. / 要搜尋的關鍵字。
replacementstringThe replacement text. / 要替換的新文字。
SetFont(string)
Short overload of SetFont that accepts westernFont; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernFont;其餘可選參數使用預設值並轉呼叫最長 SetFont 多載。
public void SetFont(string westernFont)
Parameters
westernFontstring
SetFont(string, string?)
Short overload of SetFont that accepts westernFont and asianFont; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernFont 與 asianFont;其餘可選參數使用預設值並轉呼叫最長 SetFont 多載。
public void SetFont(string westernFont, string? asianFont)
Parameters
SetFont(string, string?, string?)
Sets the paragraph's font names. 設定段落的字型名稱。
public void SetFont(string westernFont, string? asianFont, string? complexFont)
Parameters
westernFontstringThe Western font name. / 西文字型名稱。
asianFontstringThe East Asian (CJK) font name. / 東亞(中日韓)字型名稱。
complexFontstringThe complex script font name. / 複雜文字字型名稱。
SetFontSize(string)
Short overload of SetFontSize that accepts westernSize; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernSize;其餘可選參數使用預設值並轉呼叫最長 SetFontSize 多載。
public void SetFontSize(string westernSize)
Parameters
westernSizestring
SetFontSize(string, string?)
Short overload of SetFontSize that accepts westernSize and asianSize; remaining optional parameters use defaults and forward to the full overload. 便利多載:提供 westernSize 與 asianSize;其餘可選參數使用預設值並轉呼叫最長 SetFontSize 多載。
public void SetFontSize(string westernSize, string? asianSize)
Parameters
SetFontSize(string, string?, string?)
Sets the paragraph's font sizes. 設定段落的字型大小。
public void SetFontSize(string westernSize, string? asianSize, string? complexSize)
Parameters
westernSizestringThe Western font size. / 西文字型大小。
asianSizestringThe East Asian font size. / 東亞字型大小。
complexSizestringThe complex script font size. / 複雜文字字型大小。
SetOutlineLevel(int)
Sets this paragraph to the specified outline level. 將此段落設定為指定的大綱階層。
public OdfParagraph SetOutlineLevel(int outlineLevel)
Parameters
outlineLevelintThe outline level, with a minimum value of 1. / 大綱階層,最小值為 1。
Returns
- OdfParagraph
The current paragraph, for chained calls. / 目前段落,供鏈式呼叫使用。