Table of Contents

Class OdfSlide

Namespace
OdfKit.Presentation
Assembly
OdfKit.dll

Provides the OdfSlide API. 提供 OdfSlide API。

public class OdfSlide
Inheritance
OdfSlide
Inherited Members

Constructors

OdfSlide(OdfNode, PresentationDocument)

Represents a presentation slide. 表示簡報投影片(Slide)的類別。

public OdfSlide(OdfNode node, PresentationDocument doc)

Parameters

node OdfNode

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

doc PresentationDocument

The owning presentation document instance. / 所屬的簡報文件執行個體。

Properties

AnimationRoot

Gets the animation root node. 取得動畫根節點。

public OdfAnimationNode AnimationRoot { get; }

Property Value

OdfAnimationNode

BackgroundColor

Gets or sets the slide background color, such as #FFFFFF. 取得或設定投影片背景色(例如 #FFFFFF)。

public string? BackgroundColor { get; set; }

Property Value

string

Document

Gets the owning presentation document. 取得所屬的簡報文件。

public PresentationDocument Document { get; }

Property Value

PresentationDocument

MasterPageName

Gets or sets the master page name used by the slide. 取得或設定投影片使用的母片名稱。

public string MasterPageName { get; set; }

Property Value

string

Name

Gets or sets the slide name. 取得或設定投影片名稱。

public string Name { get; set; }

Property Value

string

Pictures

Gets the pictures on the slide. 取得投影片上的圖片清單。

public IReadOnlyList<OdfPicture> Pictures { get; }

Property Value

IReadOnlyList<OdfPicture>

Placeholders

Gets the read-only list of all placeholders in the slide. 取得投影片中所有預留位置的唯讀清單。

public IReadOnlyList<OdfPlaceholder> Placeholders { get; }

Property Value

IReadOnlyList<OdfPlaceholder>

PresentationPageLayoutName

Gets or sets the page layout name used by the slide. 取得或設定投影片使用的版面配置名稱。

public string? PresentationPageLayoutName { get; set; }

Property Value

string

Shapes

Gets the general shapes on the slide. 取得投影片上的一般圖形清單。

public IReadOnlyList<OdfShape> Shapes { get; }

Property Value

IReadOnlyList<OdfShape>

SpeakerNoteParagraphs

Gets the paragraph text of the slide speaker notes. 取得投影片備忘錄的段落文字。

public IReadOnlyList<string> SpeakerNoteParagraphs { get; }

Property Value

IReadOnlyList<string>

SpeakerNotes

Gets or sets the slide speaker notes text. 取得或設定投影片備忘錄文字。

public string SpeakerNotes { get; set; }

Property Value

string

SpeakerNotesPage

Gets the slide notes page. 取得投影片的備忘錄頁面(Notes Page)。

public OdfNotesPage SpeakerNotesPage { get; }

Property Value

OdfNotesPage

TextBoxes

Gets the text boxes on the slide. 取得投影片上的文字方塊清單。

public IReadOnlyList<OdfTextBox> TextBoxes { get; }

Property Value

IReadOnlyList<OdfTextBox>

UseDateTimeName

Gets or sets the style name used by the slide date and time field. 取得或設定投影片日期與時間使用的樣式名稱。

public string? UseDateTimeName { get; set; }

Property Value

string

UseFooterName

Gets or sets the style name used by the slide footer. 取得或設定投影片頁尾使用的樣式名稱。

public string? UseFooterName { get; set; }

Property Value

string

UseHeaderName

Gets or sets the style name used by the slide header. 取得或設定投影片頁首使用的樣式名稱。

public string? UseHeaderName { get; set; }

Property Value

string

Methods

AddAudio(string, OdfLength, OdfLength, OdfLength, OdfLength)

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

public OdfMediaObject AddAudio(string packagePath, OdfLength x, OdfLength y, OdfLength width, OdfLength height)

Parameters

packagePath string
x OdfLength
y OdfLength
width OdfLength
height OdfLength

Returns

OdfMediaObject

AddAudio(string, OdfLength, OdfLength, OdfLength, OdfLength, string)

Adds an audio object to the slide. 在投影片上新增音訊物件。

public OdfMediaObject AddAudio(string packagePath, OdfLength x, OdfLength y, OdfLength width, OdfLength height, string mimeType)

Parameters

packagePath string

The audio path inside the package. / 音訊在封裝包內的路徑。

x OdfLength

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

y OdfLength

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

width OdfLength

The width. / 寬度。

height OdfLength

The height. / 高度。

mimeType string

The audio MIME type. / 音訊 MIME 類型。

Returns

OdfMediaObject

The newly created media object. / 新建立的媒體物件。

AddEmbeddedObject(string, OdfLength, OdfLength, OdfLength, OdfLength)

Adds an embedded object, such as another document or subcomponent, to the slide. 在投影片上新增內嵌物件(如其他文件或子組件)。

public OdfShape AddEmbeddedObject(string subPath, OdfLength x, OdfLength y, OdfLength w, OdfLength h)

Parameters

subPath string

The path of the embedded object inside the package. / 內嵌物件於套件內的路徑。

x OdfLength

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

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

Returns

OdfShape

The added embedded object shape instance. / 新增內嵌物件圖形執行個體。

AddEmphasisEffect(string, OdfAnimationEffect)

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

public OdfAnimation AddEmphasisEffect(string shapeId, OdfAnimationEffect effect)

Parameters

shapeId string
effect OdfAnimationEffect

Returns

OdfAnimation

AddEmphasisEffect(string, OdfAnimationEffect, TimeSpan)

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

public OdfAnimation AddEmphasisEffect(string shapeId, OdfAnimationEffect effect, TimeSpan duration)

Parameters

shapeId string
effect OdfAnimationEffect
duration TimeSpan

Returns

OdfAnimation

AddEmphasisEffect(string, OdfAnimationEffect, TimeSpan, OdfAnimationTrigger)

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

public OdfAnimation AddEmphasisEffect(string shapeId, OdfAnimationEffect effect, TimeSpan duration, OdfAnimationTrigger trigger)

Parameters

shapeId string
effect OdfAnimationEffect
duration TimeSpan
trigger OdfAnimationTrigger

Returns

OdfAnimation

AddEmphasisEffect(string, OdfAnimationEffect, TimeSpan, OdfAnimationTrigger, TimeSpan)

Adds an emphasis animation to the specified shape. 為指定的圖形新增物件強調動畫。

public OdfAnimation AddEmphasisEffect(string shapeId, OdfAnimationEffect effect, TimeSpan duration, OdfAnimationTrigger trigger, TimeSpan delay)

Parameters

shapeId string

The target shape identifier. / 目標圖形識別碼。

effect OdfAnimationEffect

The animation effect type. / 動畫效果類型。

duration TimeSpan

The animation duration; defaults to 0.5 seconds. / 動畫持續時間;預設為 0.5 秒。

trigger OdfAnimationTrigger

The animation trigger mode. / 動畫觸發方式。

delay TimeSpan

The animation startup delay. / 動畫延遲啟動時間。

Returns

OdfAnimation

The added animation object instance. / 新增的動畫物件執行個體。

AddEntranceEffect(string, OdfAnimationEffect, OdfAnimationTrigger)

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

public OdfAnimation AddEntranceEffect(string shapeId, OdfAnimationEffect effect, OdfAnimationTrigger trigger)

Parameters

shapeId string
effect OdfAnimationEffect
trigger OdfAnimationTrigger

Returns

OdfAnimation

AddEntranceEffect(string, OdfAnimationEffect, OdfAnimationTrigger, TimeSpan)

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

public OdfAnimation AddEntranceEffect(string shapeId, OdfAnimationEffect effect, OdfAnimationTrigger trigger, TimeSpan delay)

Parameters

shapeId string
effect OdfAnimationEffect
trigger OdfAnimationTrigger
delay TimeSpan

Returns

OdfAnimation

AddEntranceEffect(string, OdfAnimationEffect, OdfAnimationTrigger, TimeSpan, TimeSpan)

Adds an entrance animation to the specified shape. 為指定的圖形新增物件進場動畫。

public OdfAnimation AddEntranceEffect(string shapeId, OdfAnimationEffect effect, OdfAnimationTrigger trigger, TimeSpan delay, TimeSpan duration)

Parameters

shapeId string

The target shape identifier. / 目標圖形識別碼。

effect OdfAnimationEffect

The animation effect type. / 動畫效果類型。

trigger OdfAnimationTrigger

The animation trigger mode. / 動畫觸發方式。

delay TimeSpan

The animation startup delay. / 動畫延遲啟動時間。

duration TimeSpan

The animation duration; defaults to 0.5 seconds. / 動畫持續時間;預設為 0.5 秒。

Returns

OdfAnimation

The added animation object instance. / 新增的動畫物件執行個體。

AddExitEffect(string, OdfAnimationEffect, OdfAnimationTrigger)

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

public OdfAnimation AddExitEffect(string shapeId, OdfAnimationEffect effect, OdfAnimationTrigger trigger)

Parameters

shapeId string
effect OdfAnimationEffect
trigger OdfAnimationTrigger

Returns

OdfAnimation

AddExitEffect(string, OdfAnimationEffect, OdfAnimationTrigger, TimeSpan)

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

public OdfAnimation AddExitEffect(string shapeId, OdfAnimationEffect effect, OdfAnimationTrigger trigger, TimeSpan delay)

Parameters

shapeId string
effect OdfAnimationEffect
trigger OdfAnimationTrigger
delay TimeSpan

Returns

OdfAnimation

AddExitEffect(string, OdfAnimationEffect, OdfAnimationTrigger, TimeSpan, TimeSpan)

Adds an exit animation to the specified shape. 為指定的圖形新增物件退場動畫。

public OdfAnimation AddExitEffect(string shapeId, OdfAnimationEffect effect, OdfAnimationTrigger trigger, TimeSpan delay, TimeSpan duration)

Parameters

shapeId string

The target shape identifier. / 目標圖形識別碼。

effect OdfAnimationEffect

The animation effect type. / 動畫效果類型。

trigger OdfAnimationTrigger

The animation trigger mode. / 動畫觸發方式。

delay TimeSpan

The animation startup delay. / 動畫延遲啟動時間。

duration TimeSpan

The animation duration; defaults to 0.5 seconds. / 動畫持續時間;預設為 0.5 秒。

Returns

OdfAnimation

The added animation object instance. / 新增的動畫物件執行個體。

AddLine(OdfLength, OdfLength, OdfLength, OdfLength)

Adds a line shape to the slide. 在投影片上新增直線圖形。

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

Parameters

x1 OdfLength

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

y1 OdfLength

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

x2 OdfLength

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

y2 OdfLength

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

Returns

OdfShape

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

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

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

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

Parameters

imageBytes byte[]
x OdfLength
y OdfLength
w OdfLength
h OdfLength

Returns

OdfPicture

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

Adds an image to the slide. 在投影片上新增圖片。

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

Parameters

imageBytes byte[]

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

x OdfLength

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

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

altText string

The optional image alternative text. / 選用的圖片替代文字。

Returns

OdfPicture

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

AddPlaceholder(OdfPlaceholderType, OdfLength, OdfLength, OdfLength, OdfLength)

Adds a placeholder to the slide. 在投影片上新增一個預留位置(Placeholder)。

public OdfPlaceholder AddPlaceholder(OdfPlaceholderType type, OdfLength x, OdfLength y, OdfLength w, OdfLength h)

Parameters

type OdfPlaceholderType

The placeholder type. / 預留位置類型。

x OdfLength

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

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

Returns

OdfPlaceholder

The added placeholder shape instance. / 新增的預留位置圖形執行個體。

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

Adds a polyline shape to the slide. 在投影片上新增折線圖形。

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

Parameters

points IEnumerable<PointF>

The point coordinate collection. / 點座標集合。

x OdfLength

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

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

Returns

OdfShape

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

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

Adds a basic shape to the slide. 在投影片上新增基本圖形。

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

Parameters

shapeType OdfShapeType

The shape type. / 圖形類型。

x OdfLength

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

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

Returns

OdfShape

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

AddTextBox(OdfLength, OdfLength, OdfLength, OdfLength, IEnumerable<string>)

Adds a multi-paragraph text box to the slide. 在投影片上新增多段落文字方塊。

public OdfTextBox AddTextBox(OdfLength x, OdfLength y, OdfLength w, OdfLength h, IEnumerable<string> paragraphs)

Parameters

x OdfLength

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

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

paragraphs IEnumerable<string>

The paragraph text collection. / 段落文字集合。

Returns

OdfTextBox

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

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

Adds a text box to the slide. 在投影片上新增文字方塊。

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

Parameters

x OdfLength

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

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

text string

The text content. / 文字內容。

Returns

OdfTextBox

The added text box shape 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 coordinate position. / X 軸座標位置。

y OdfLength

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

w OdfLength

The width. / 寬度。

h OdfLength

The height. / 高度。

text string

The text content. / 文字內容。

options OdfTextFontFallbackOptions

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

Returns

OdfTextBox

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

AddVideo(string, OdfLength, OdfLength, OdfLength, OdfLength)

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

public OdfMediaObject AddVideo(string packagePath, OdfLength x, OdfLength y, OdfLength width, OdfLength height)

Parameters

packagePath string
x OdfLength
y OdfLength
width OdfLength
height OdfLength

Returns

OdfMediaObject

AddVideo(string, OdfLength, OdfLength, OdfLength, OdfLength, string)

Adds a video object to the slide. 在投影片上新增影片物件。

public OdfMediaObject AddVideo(string packagePath, OdfLength x, OdfLength y, OdfLength width, OdfLength height, string mimeType)

Parameters

packagePath string

The video path inside the package. / 影片在封裝包內的路徑。

x OdfLength

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

y OdfLength

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

width OdfLength

The width. / 寬度。

height OdfLength

The height. / 高度。

mimeType string

The video MIME type. / 影片 MIME 類型。

Returns

OdfMediaObject

The newly created media object. / 新建立的媒體物件。

ApplyPresentationPageLayout(string)

Applies the presentation page layout with the specified name to this slide. 將指定名稱的投影片版面配置套用至此投影片。

public void ApplyPresentationPageLayout(string layoutName)

Parameters

layoutName string

The page layout name. / 版面配置名稱。

GetAnimations()

Gets the summary list of all animation effects on this slide. 取得此投影片上所有動畫效果的摘要清單。

public IReadOnlyList<OdfAnimationInfo> GetAnimations()

Returns

IReadOnlyList<OdfAnimationInfo>

GetLayout()

Gets the layout type of this slide. 取得此投影片的版面配置型態。

public OdfPresentationLayout GetLayout()

Returns

OdfPresentationLayout

The layout type. / 版面配置型態。

GetPlaceholderInfos()

Gets the summary list of all placeholders in the slide. 取得投影片中所有預留位置的摘要清單。

public IReadOnlyList<OdfPlaceholderInfo> GetPlaceholderInfos()

Returns

IReadOnlyList<OdfPlaceholderInfo>

SetLayout(OdfPresentationLayout)

Sets the layout type of this slide and automatically arranges the corresponding placeholders. 設定此投影片的版面配置型態,並自動配置對應的預留位置。

public void SetLayout(OdfPresentationLayout layout)

Parameters

layout OdfPresentationLayout

The layout type. / 版面配置型態。

SetMasterPage(string)

Sets the master page name used by this slide. 設定此投影片使用的母片名稱。

public void SetMasterPage(string masterPageName)

Parameters

masterPageName string

The master page name. / 母片名稱。

SetSpeakerNotes(IEnumerable<string>)

Sets slide speaker notes as multiple paragraphs. 以多段落形式設定投影片備忘錄文字。

public OdfSlide SetSpeakerNotes(IEnumerable<string> paragraphs)

Parameters

paragraphs IEnumerable<string>

The paragraph text collection. / 段落文字集合。

Returns

OdfSlide

The current slide. / 目前投影片。

SetTransition(OdfTransitionType, OdfLength)

Sets the slide transition animation effect. 設定投影片切換動畫效果。

public void SetTransition(OdfTransitionType type, OdfLength duration)

Parameters

type OdfTransitionType

The transition effect type. / 切換效果類型。

duration OdfLength

The duration. / 持續時間。

SetTransition(OdfTransitionType, OdfLength, OdfTransitionSpeed)

Sets the slide transition animation effect and speed. 設定投影片切換動畫效果與速度。

public void SetTransition(OdfTransitionType type, OdfLength duration, OdfTransitionSpeed speed)

Parameters

type OdfTransitionType

The transition effect type. / 切換效果類型。

duration OdfLength

The duration. / 持續時間。

speed OdfTransitionSpeed

The transition speed. / 切換速度。