Table of Contents

Class SlideManager

Namespace
MarkMyDeck.OpenXml
Assembly
MarkMyDeck.dll

Manages the current slide's content using a title shape and a content shape.

public class SlideManager
Inheritance
object
SlideManager

Constructors

SlideManager(SlidePart, PresentationBuilder)

public SlideManager(SlidePart slidePart, PresentationBuilder builder)

Parameters

slidePart SlidePart
builder PresentationBuilder

Properties

Builder

public PresentationBuilder Builder { get; }

Property Value

PresentationBuilder

ContentWidth

Gets the available content width in EMUs.

public long ContentWidth { get; }

Property Value

long

EstimatedNextY

The estimated Y position if another content paragraph were added.

public long EstimatedNextY { get; }

Property Value

long

IsOverflowing

Whether the current slide's content has exceeded the available space.

public bool IsOverflowing { get; }

Property Value

bool

Options

public ConversionOptions Options { get; }

Property Value

ConversionOptions

RemainingHeight

Gets the remaining vertical space from the current Y position to the bottom margin.

public long RemainingHeight { get; }

Property Value

long

SlidePart

public SlidePart SlidePart { get; }

Property Value

SlidePart

Styles

public SlideStyleConfiguration Styles { get; }

Property Value

SlideStyleConfiguration

WouldOverflowWithParagraph

Whether adding another content paragraph would overflow.

public bool WouldOverflowWithParagraph { get; }

Property Value

bool

Methods

AddCodeBlockShape(long, string)

Adds a standalone text box with a solid background fill (for code blocks). If a content shape exists, shrinks it and positions the code block below.

public Shape AddCodeBlockShape(long height, string bgColorHex)

Parameters

height long
bgColorHex string

Returns

Shape

AddContentParagraph()

Adds a paragraph to the content shape and tracks estimated height.

public Paragraph AddContentParagraph()

Returns

Paragraph

AddHyperlinkRelationship(string)

Adds a hyperlink relationship to the slide part.

public string AddHyperlinkRelationship(string url)

Parameters

url string

Returns

string

AddImage(byte[], string, long, long)

Adds an image to the slide with smart placement:

  • Landscape images: above or below content
  • Portrait images: left or right of content, alternating
public void AddImage(byte[] imageData, string contentType, long widthEmu, long heightEmu)

Parameters

imageData byte[]
contentType string
widthEmu long
heightEmu long

AddParagraphToShape(Shape)

Adds a paragraph to an existing shape's TextBody.

public Paragraph AddParagraphToShape(Shape shape)

Parameters

shape Shape

Returns

Paragraph

AddTable(int, int, long)

Adds a table to the slide at the current position.

public Table AddTable(int rows, int cols, long height)

Parameters

rows int
cols int
height long

Returns

Table

AddTitleParagraph()

Adds a paragraph to the title shape.

public Paragraph AddTitleParagraph()

Returns

Paragraph

CreateHyperlinkRun(string, string, string, int)

Creates a run with hyperlink.

public Run CreateHyperlinkRun(string text, string url, string fontName, int fontSizePt)

Parameters

text string
url string
fontName string
fontSizePt int

Returns

Run

CreateRun(string, string, int, string?, bool, bool, bool)

Creates a run with specified text and formatting.

public Run CreateRun(string text, string fontName, int fontSizePt, string? colorHex = null, bool bold = false, bool italic = false, bool underline = false)

Parameters

text string
fontName string
fontSizePt int
colorHex string
bold bool
italic bool
underline bool

Returns

Run

GetOrCreateContentShape()

Gets or creates the main content shape (body of slide, below title).

public Shape GetOrCreateContentShape()

Returns

Shape

GetOrCreateTitleShape()

Gets or creates the title shape (inside the title bar).

public Shape GetOrCreateTitleShape()

Returns

Shape

GetShapeTree()

Gets the shape tree of the current slide.

public ShapeTree GetShapeTree()

Returns

ShapeTree

GetTitleText()

Gets the last title text (for continuation slides).

public string? GetTitleText()

Returns

string

SyncCursorAfterContent()

Advances the Y cursor past the content shape so standalone elements appear below it. Call this before adding code blocks, tables, or images if content shape exists.

public void SyncCursorAfterContent()

WouldOverflowWithCodeBlock(long)

Whether a code block of given height would overflow.

public bool WouldOverflowWithCodeBlock(long height)

Parameters

height long

Returns

bool