目錄 / Table of Contents

Class OdfParagraphCollection

Namespace
OdfKit.Text
Assembly
OdfKit.dll

Adds paragraphs to text documents. 提供段落新增入口。

public sealed class OdfParagraphCollection : IEnumerable<OdfParagraph>, IEnumerable
Inheritance
OdfParagraphCollection
Implements
Inherited Members

Constructors

OdfParagraphCollection(TextDocument)

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

public OdfParagraphCollection(TextDocument document)

Parameters

document TextDocument

The owning text document. / 所屬文字文件。

Properties

Items

Gets a summary list of the top-level paragraphs in the document body. 取得文件本文最上層段落清單。

public IReadOnlyList<OdfParagraph> Items { get; }

Property Value

IReadOnlyList<OdfParagraph>

Methods

Add()

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

public OdfParagraph Add()

Returns

OdfParagraph

Add(string)

Adds a paragraph to the collection. 新增段落。

public OdfParagraph Add(string text)

Parameters

text string

The paragraph text. / 段落文字。

Returns

OdfParagraph

The newly added paragraph. / 新增完成的段落。

Clear()

Removes all top-level paragraphs while preserving other body content. 移除所有最上層段落,並保留其他本文內容。

public void Clear()

Find(Predicate<OdfParagraph>)

Finds the first top-level paragraph that satisfies the predicate. 查找第一個符合條件的最上層段落。

public OdfParagraph? Find(Predicate<OdfParagraph> predicate)

Parameters

predicate Predicate<OdfParagraph>

The paragraph predicate. / 段落條件。

Returns

OdfParagraph

The matching paragraph, or null when no match exists. / 符合的段落;若找不到則為 null

GetEnumerator()

Gets an enumerator over the paragraphs, for use with LINQ queries. 取得段落列舉器,供 LINQ 查詢使用。

public IEnumerator<OdfParagraph> GetEnumerator()

Returns

IEnumerator<OdfParagraph>

The paragraph enumerator. / 段落列舉器。

Remove(OdfParagraph)

Removes the specified top-level paragraph. 移除指定的最上層段落。

public bool Remove(OdfParagraph paragraph)

Parameters

paragraph OdfParagraph

The paragraph to remove. / 要移除的段落。

Returns

bool

true if the paragraph was removed; otherwise, false. / 若已移除段落則為 true;否則為 false