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
-
objectSlideManager
Constructors
SlideManager(SlidePart, PresentationBuilder)
public SlideManager(SlidePart slidePart, PresentationBuilder builder)
Parameters
slidePartSlidePartbuilderPresentationBuilder
Properties
Builder
public PresentationBuilder Builder { get; }
Property Value
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
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
Styles
public SlideStyleConfiguration Styles { get; }
Property Value
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
heightlongbgColorHexstring
Returns
AddContentParagraph()
Adds a paragraph to the content shape and tracks estimated height.
public Paragraph AddContentParagraph()
Returns
AddHyperlinkRelationship(string)
Adds a hyperlink relationship to the slide part.
public string AddHyperlinkRelationship(string url)
Parameters
urlstring
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
imageDatabyte[]contentTypestringwidthEmulongheightEmulong
AddParagraphToShape(Shape)
Adds a paragraph to an existing shape's TextBody.
public Paragraph AddParagraphToShape(Shape shape)
Parameters
shapeShape
Returns
AddTable(int, int, long)
Adds a table to the slide at the current position.
public Table AddTable(int rows, int cols, long height)
Parameters
rowsintcolsintheightlong
Returns
AddTitleParagraph()
Adds a paragraph to the title shape.
public Paragraph AddTitleParagraph()
Returns
CreateHyperlinkRun(string, string, string, int)
Creates a run with hyperlink.
public Run CreateHyperlinkRun(string text, string url, string fontName, int fontSizePt)
Parameters
textstringurlstringfontNamestringfontSizePtint
Returns
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
textstringfontNamestringfontSizePtintcolorHexstringboldboolitalicboolunderlinebool
Returns
GetOrCreateContentShape()
Gets or creates the main content shape (body of slide, below title).
public Shape GetOrCreateContentShape()
Returns
GetOrCreateTitleShape()
Gets or creates the title shape (inside the title bar).
public Shape GetOrCreateTitleShape()
Returns
GetShapeTree()
Gets the shape tree of the current slide.
public ShapeTree GetShapeTree()
Returns
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
heightlong
Returns
- bool