目錄 / Table of Contents

Class OdfDrawPage

Namespace
OdfKit.Drawing
Assembly
OdfKit.dll

Provides the OdfDrawPage API. 提供 OdfDrawPage API。

public class OdfDrawPage
Inheritance
OdfDrawPage
Inherited Members

Constructors

OdfDrawPage(OdfNode, DrawingDocument)

Represents an ODF drawing page. 表示 ODF 繪圖頁面(Drawing Page)的類別。

public OdfDrawPage(OdfNode node, DrawingDocument doc)

Parameters

node OdfNode

The underlying OdfKit.DOM.OdfNode instance. / 底層的 OdfKit.DOM.OdfNode 執行個體。

doc DrawingDocument

The owning drawing document instance. / 所屬的繪圖文件執行個體。

Properties

Document

Gets the owning drawing document. 取得所屬的繪圖文件。

public DrawingDocument Document { get; }

Property Value

DrawingDocument

MasterPageName

Gets or sets the master page name used by the drawing page. 取得或設定繪圖頁面所使用的母片名稱。

public string? MasterPageName { get; set; }

Property Value

string

Name

Gets or sets the name of the drawing page. 取得或設定繪圖頁面的名稱。

public string Name { get; set; }

Property Value

string

Node

Gets the underlying ODF node. 取得底層的 ODF 節點。

public OdfNode Node { get; }

Property Value

OdfNode

Pictures

Gets the list of pictures on the drawing page. 取得繪圖頁面上的圖片清單。

public IReadOnlyList<OdfPicture> Pictures { get; }

Property Value

IReadOnlyList<OdfPicture>

Shapes

Gets the list of generic shapes on the drawing page. 取得繪圖頁面上的一般圖形清單。

public IReadOnlyList<OdfShape> Shapes { get; }

Property Value

IReadOnlyList<OdfShape>

TextBoxes

Gets the list of text boxes on the drawing page. 取得繪圖頁面上的文字方塊清單。

public IReadOnlyList<OdfTextBox> TextBoxes { get; }

Property Value

IReadOnlyList<OdfTextBox>

Methods

AddConnector(OdfLength, OdfLength, OdfLength, OdfLength)

Adds a connector on the drawing page. 在繪圖頁面上新增連接線。

public OdfShape AddConnector(OdfLength x1, OdfLength y1, OdfLength x2, OdfLength y2)

Parameters

x1 OdfLength

The start X-axis position. / 起點 X 軸座標位置。

y1 OdfLength

The start Y-axis position. / 起點 Y 軸座標位置。

x2 OdfLength

The end X-axis position. / 終點 X 軸座標位置。

y2 OdfLength

The end Y-axis position. / 終點 Y 軸座標位置。

Returns

OdfShape

The newly added connector shape instance. / 新增的連接線圖形執行個體。

AddConnector(string, string)

Creates a connector linking a start shape and an end shape on the drawing page. 在繪圖頁面上建立起點與終點相連的連接線。

public OdfShape AddConnector(string startShapeId, string endShapeId)

Parameters

startShapeId string
endShapeId string

Returns

OdfShape

The newly added connector shape instance. / 新增的連接線圖形執行個體。

AddConnector(string, string, OdfConnectorType)

Full overload of AddConnector that accepts startShapeId, endShapeId, and connectorType. AddConnector 完整多載:接受 startShapeId、endShapeId 與 connectorType。

public OdfShape AddConnector(string startShapeId, string endShapeId, OdfConnectorType connectorType)

Parameters

startShapeId string
endShapeId string
connectorType OdfConnectorType

Returns

OdfShape

AddCustomShape(string, OdfLength, OdfLength, OdfLength, OdfLength)

Adds a custom shape on the drawing page. 在繪圖頁面上新增自定義幾何圖形。

public OdfShape AddCustomShape(string shapeType, OdfLength x, OdfLength y, OdfLength width, OdfLength height)

Parameters

shapeType string

The geometry type of the custom shape. / 自定義幾何圖形的幾何類型。

x OdfLength

The X-axis position. / X 軸座標位置。

y OdfLength

The Y-axis position. / Y 軸座標位置。

width OdfLength

The width. / 寬度。

height OdfLength

The height. / 高度。

Returns

OdfShape

The newly added custom shape instance. / 新增的自定義幾何圖形執行個體。

AddGroup()

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

public OdfDrawGroup AddGroup()

Returns

OdfDrawGroup

AddGroup(string?)

Adds a group on the drawing page. 在繪圖頁面上新增群組。

public OdfDrawGroup AddGroup(string? name)

Parameters

name string

The optional group name. / 選用的群組名稱。

Returns

OdfDrawGroup

The newly added drawing group instance. / 新增的繪圖群組執行個體。

AddLine(OdfLength, OdfLength, OdfLength, OdfLength)

Adds a line segment on the drawing page. 在繪圖頁面上新增線段。

public OdfShape AddLine(OdfLength x1, OdfLength y1, OdfLength x2, OdfLength y2)

Parameters

x1 OdfLength

The start X-axis position. / 起點 X 軸座標位置。

y1 OdfLength

The start Y-axis position. / 起點 Y 軸座標位置。

x2 OdfLength

The end X-axis position. / 終點 X 軸座標位置。

y2 OdfLength

The end Y-axis position. / 終點 Y 軸座標位置。

Returns

OdfShape

The newly added line shape instance. / 新增的線段圖形執行個體。

AddPath(string, OdfLength, OdfLength, OdfLength, OdfLength)

Adds a path shape on the drawing page. 在繪圖頁面上新增路徑圖形。

public OdfShape AddPath(string svgPathData, OdfLength x, OdfLength y, OdfLength width, OdfLength height)

Parameters

svgPathData string

The SVG path data description string. / SVG path data 路徑描述字串。

x OdfLength

The X-axis position. / X 軸座標位置。

y OdfLength

The Y-axis position. / Y 軸座標位置。

width OdfLength

The width. / 寬度。

height OdfLength

The height. / 高度。

Returns

OdfShape

The newly added path shape instance. / 新增的路徑圖形執行個體。

AddPicture(byte[], OdfLength, OdfLength, OdfLength, OdfLength)

Adds a picture on the drawing page. 在繪圖頁面上新增圖片。

public OdfPicture AddPicture(byte[] imageBytes, OdfLength x, OdfLength y, OdfLength w, OdfLength h)

Parameters

imageBytes byte[]

The image byte array. / 圖片的位元組陣列。

x OdfLength

The X-axis position. / X 軸座標位置。

y OdfLength

The Y-axis position. / Y 軸座標位置。

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

Returns

OdfPicture

The newly added picture shape instance. / 新增的圖片圖形執行個體。

AddPolygon(IEnumerable<(OdfLength X, OdfLength Y)>)

Adds a polygon shape on the drawing page. 在繪圖頁面上新增多邊形圖形。

public OdfShape AddPolygon(IEnumerable<(OdfLength X, OdfLength Y)> points)

Parameters

points IEnumerable<(OdfLength X, OdfLength Y)>

The length-based coordinate collection of polygon vertices. / 多邊形頂點的長度座標集合。

Returns

OdfShape

The newly added polygon shape instance. / 新增的多邊形圖形執行個體。

AddPolyline(IEnumerable<PointF>, OdfLength, OdfLength, OdfLength, OdfLength)

Adds a polyline shape on the drawing page. 在繪圖頁面上新增折線圖形。

public OdfShape AddPolyline(IEnumerable<PointF> points, OdfLength x, OdfLength y, OdfLength w, OdfLength h)

Parameters

points IEnumerable<PointF>

The collection of point coordinates. / 點座標集合。

x OdfLength

The X-axis position. / X 軸座標位置。

y OdfLength

The Y-axis position. / Y 軸座標位置。

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

Returns

OdfShape

The newly added polyline shape instance. / 新增的折線圖形執行個體。

AddShape(OdfShapeType, OdfLength, OdfLength, OdfLength, OdfLength)

Adds a shape on the drawing page. 在繪圖頁面上新增圖形。

public OdfShape AddShape(OdfShapeType shapeType, OdfLength x, OdfLength y, OdfLength w, OdfLength h)

Parameters

shapeType OdfShapeType

The shape type. / 圖形類型。

x OdfLength

The X-axis position. / X 軸座標位置。

y OdfLength

The Y-axis position. / Y 軸座標位置。

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

Returns

OdfShape

The newly added shape instance. / 新增的圖形執行個體。

AddTextBox(OdfLength, OdfLength, OdfLength, OdfLength, string)

Adds a text box on the drawing page. 在繪圖頁面上新增文字方塊。

public OdfTextBox AddTextBox(OdfLength x, OdfLength y, OdfLength w, OdfLength h, string text)

Parameters

x OdfLength

The X-axis position. / X 軸座標位置。

y OdfLength

The Y-axis position. / Y 軸座標位置。

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

text string

The text content. / 文字內容。

Returns

OdfTextBox

The newly added text box instance. / 新增的文字方塊執行個體。

AddTextBox(OdfLength, OdfLength, OdfLength, OdfLength, string, OdfTextFontFallbackOptions)

Adds a text box with the specified font fallback options. 使用指定的字型遞補選項新增文字方塊。

public OdfTextBox AddTextBox(OdfLength x, OdfLength y, OdfLength w, OdfLength h, string text, OdfTextFontFallbackOptions options)

Parameters

x OdfLength

The X-axis position. / X 軸座標位置。

y OdfLength

The Y-axis position. / Y 軸座標位置。

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

text string

The text content. / 文字內容。

options OdfTextFontFallbackOptions

The font fallback options. / 字型遞補選項。

Returns

OdfTextBox

The newly added text box instance. / 新增的文字方塊執行個體。

AlignShapes(IEnumerable<string>, OdfShapeAlignment)

Aligns the specified shapes while preserving their sizes. 對齊指定圖形並保留其大小。

public OdfShapeLayoutResult AlignShapes(IEnumerable<string> shapeIds, OdfShapeAlignment alignment)

Parameters

shapeIds IEnumerable<string>

The drawing shape identifiers. / 繪圖圖形識別碼。

alignment OdfShapeAlignment

The requested alignment. / 要套用的對齊模式。

Returns

OdfShapeLayoutResult

A structured layout result. / 結構化版面配置結果。

BringToFront(string)

Moves a drawing object to the front of its current parent stacking order. 將繪圖物件移至目前父節點堆疊順序的最前方。

public bool BringToFront(string id)

Parameters

id string

The exact object identifier. / 物件的精確識別碼。

Returns

bool

true if moved; otherwise false. / 若已移動則為 true,否則為 false

ClearShapes()

Removes all top-level drawing objects and their referencing connectors while preserving layer and unknown content. 移除所有最上層繪圖物件及其引用連接線,並保留圖層與未知內容。

public int ClearShapes()

Returns

int

The number of removed top-level objects. / 已移除的最上層物件數量。

DistributeShapes(IEnumerable<string>, OdfShapeDistribution)

Distributes the specified shapes with equal gaps between their bounds. 依圖形邊界以相等間距分布指定圖形。

public OdfShapeLayoutResult DistributeShapes(IEnumerable<string> shapeIds, OdfShapeDistribution distribution)

Parameters

shapeIds IEnumerable<string>

The drawing shape identifiers. / 繪圖圖形識別碼。

distribution OdfShapeDistribution

The requested distribution direction. / 要套用的分布方向。

Returns

OdfShapeLayoutResult

A structured layout result. / 結構化版面配置結果。

FindLayer(string)

Finds a layer by its exact name. 依精確名稱尋找圖層。

public OdfLayerInfo? FindLayer(string name)

Parameters

name string

The exact layer name. / 圖層的精確名稱。

Returns

OdfLayerInfo

The matching layer summary, or null. / 相符的圖層摘要;若不存在則為 null

FindShape(string)

Finds a drawing object by its draw or XML identifier. 依 draw 或 XML 識別碼查找繪圖物件。

public OdfShape? FindShape(string id)

Parameters

id string

The drawing object identifier. / 繪圖物件識別碼。

Returns

OdfShape

The matching shape, or null when no match exists. / 符合的圖形;若找不到則為 null

GetConnectors()

Gets a summary list of all connectors on this drawing page. 取得此繪圖頁面上所有連接線的摘要清單。

public IReadOnlyList<OdfConnectorInfo> GetConnectors()

Returns

IReadOnlyList<OdfConnectorInfo>

GetCustomShapes()

Gets a summary list of all custom shapes on this drawing page. 取得此繪圖頁面上所有自定義幾何圖形的摘要清單。

public IReadOnlyList<OdfCustomShapeInfo> GetCustomShapes()

Returns

IReadOnlyList<OdfCustomShapeInfo>

GetGroups()

Gets a summary list of all group shapes on this drawing page. 取得此繪圖頁面上所有群組圖形的摘要清單。

public IReadOnlyList<OdfGroupInfo> GetGroups()

Returns

IReadOnlyList<OdfGroupInfo>

GetLayers()

Gets a summary list of all layers on this drawing page. 取得此繪圖頁面上所有圖層的摘要清單。

public IReadOnlyList<OdfLayerInfo> GetLayers()

Returns

IReadOnlyList<OdfLayerInfo>

GetPaths()

Gets a summary list of all path shapes on this drawing page. 取得此繪圖頁面上所有路徑圖形的摘要清單。

public IReadOnlyList<OdfPathInfo> GetPaths()

Returns

IReadOnlyList<OdfPathInfo>

GetPictures()

Gets a summary list of all pictures on this drawing page. 取得此繪圖頁面上所有圖片的摘要清單。

public IReadOnlyList<OdfDrawPictureInfo> GetPictures()

Returns

IReadOnlyList<OdfDrawPictureInfo>

GetPolygons()

Gets a summary list of all polygon shapes on this drawing page. 取得此繪圖頁面上所有多邊形圖形的摘要清單。

public IReadOnlyList<OdfPolygonInfo> GetPolygons()

Returns

IReadOnlyList<OdfPolygonInfo>

GetShapeLayerAssignments()

Gets a summary list of all shape-to-layer assignments on this drawing page. 取得此繪圖頁面上所有圖形圖層指派的摘要清單。

public IReadOnlyList<OdfDrawShapeLayerInfo> GetShapeLayerAssignments()

Returns

IReadOnlyList<OdfDrawShapeLayerInfo>

GetTextBoxes()

Gets a summary list of all text boxes on this drawing page. 取得此繪圖頁面上所有文字方塊的摘要清單。

public IReadOnlyList<OdfDrawTextBoxInfo> GetTextBoxes()

Returns

IReadOnlyList<OdfDrawTextBoxInfo>

GroupShapes(IEnumerable<string>)

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

public OdfDrawGroup GroupShapes(IEnumerable<string> shapeIds)

Parameters

shapeIds IEnumerable<string>

Returns

OdfDrawGroup

GroupShapes(IEnumerable<string>, string?)

Merges the specified shapes into a new group. 將指定圖形合併為新群組。

public OdfDrawGroup GroupShapes(IEnumerable<string> shapeIds, string? name)

Parameters

shapeIds IEnumerable<string>

The collection of shape identifiers to group. / 要群組的圖形識別碼集合。

name string

The optional group name. / 選用的群組名稱。

Returns

OdfDrawGroup

The newly created group instance. / 新建立的群組執行個體。

RemoveLayer(string, string)

Removes a layer after redirecting its assigned shapes to a replacement layer. 將指派圖形重新導向取代圖層後,移除指定圖層。

public bool RemoveLayer(string name, string replacementName)

Parameters

name string

The exact layer name to remove. / 要移除的圖層精確名稱。

replacementName string

The exact replacement layer name. / 取代圖層的精確名稱。

Returns

bool

true if removed; otherwise false. / 若已移除則為 true,否則為 false

RemoveShape(string)

Removes a drawing object and connectors that reference it. 移除繪圖物件,並一併移除參照該物件的連接線。

public bool RemoveShape(string id)

Parameters

id string

The drawing object identifier. / 繪圖物件識別碼。

Returns

bool

true if an object was removed; otherwise, false. / 若已移除物件則為 true;否則為 false

RenameLayer(string, string)

Renames a layer and updates every shape assignment on this page. 重新命名圖層,並更新此頁面上的所有圖形指派。

public bool RenameLayer(string currentName, string newName)

Parameters

currentName string

The current exact name. / 目前的精確名稱。

newName string

The replacement name. / 取代用名稱。

Returns

bool

true if renamed; otherwise false. / 若已重新命名則為 true,否則為 false

SendToBack(string)

Moves a drawing object to the back of its current parent stacking order. 將繪圖物件移至目前父節點堆疊順序的最後方。

public bool SendToBack(string id)

Parameters

id string

The exact object identifier. / 物件的精確識別碼。

Returns

bool

true if moved; otherwise false. / 若已移動則為 true,否則為 false

SetTransform(string, string?)

Sets or clears the SVG transform text of a drawing object. 設定或清除繪圖物件的 SVG transform 原文。

public bool SetTransform(string id, string? transform)

Parameters

id string

The exact object identifier. / 物件的精確識別碼。

transform string

The transform text, or null to clear it. / transform 原文;傳入 null 代表清除。

Returns

bool

true if the object exists; otherwise false. / 若物件存在則為 true,否則為 false

UpdateCustomGeometryType(string, string)

Updates the enhanced geometry type of a custom shape while preserving other geometry attributes and equations. 更新自訂圖形的增強幾何類型,並保留其它幾何屬性與方程式。

public bool UpdateCustomGeometryType(string id, string geometryType)

Parameters

id string

The exact custom-shape identifier. / 自訂圖形的精確識別碼。

geometryType string

The replacement geometry type. / 取代用幾何類型。

Returns

bool

true if updated; otherwise false. / 若已更新則為 true,否則為 false

UpdatePathData(string, string)

Updates SVG path data and recomputes the path view box. 更新 SVG path data,並重新計算路徑 view box。

public bool UpdatePathData(string id, string svgPathData)

Parameters

id string

The exact path identifier. / 路徑的精確識別碼。

svgPathData string

The replacement SVG path data. / 取代用 SVG path data。

Returns

bool

true if updated; otherwise false. / 若已更新則為 true,否則為 false

UpdatePolygonPoints(string, string)

Updates the relative point list of a polygon. 更新多邊形的相對頂點清單。

public bool UpdatePolygonPoints(string id, string points)

Parameters

id string

The exact polygon identifier. / 多邊形的精確識別碼。

points string

The replacement ODF point string. / 取代用 ODF 頂點字串。

Returns

bool

true if updated; otherwise false. / 若已更新則為 true,否則為 false