Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

PowerPointSlideReader

OfficeIMO.PowerPoint

Namespace
OfficeIMO.PowerPoint
Assembly
OfficeIMO.PowerPoint
Source revision
56dd0d38e0b5 with working tree changes
Implements
IDisposable
Modifiers
sealed

Reads the slides of a PPTX, PPTM, POTX or PPSX package one at a time without building the presentation model. Each slide part is read forward with an XmlReader when its turn comes, so memory stays proportional to one slide and the first slide is available before the rest of the deck is read.

Inheritance

  • object
  • PowerPointSlideReader

Remarks

Text is read as authored on each slide: placeholders that are empty on the slide do not pick up layout or master prompt text, and list markers come from the paragraph's own properties. Text inside SmartArt diagrams, charts and markup-compatibility fallbacks is not read. Relationships are read per slide when the slide is read, not for the whole package when it opens. The package is opened without the repair step a model load applies, so a package whose relationship targets are not valid URIs fails when the part that holds them is read; reads such packages. The reader keeps the package open until it is disposed. A file is opened for shared reading; a caller stream stays open and owned by the caller.

Usage

Explore 1 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 1

Methods

public void Dispose() #

Closes the package and any stream the reader opened.

public IEnumerable<PowerPointExtractChunk> ExtractMarkdownChunks(PowerPointExtractOptions? extract = null, PowerPointExtractChunkingOptions? chunking = null, string? sourcePath = null, CancellationToken cancellationToken = default) #

Extracts slide-aligned Markdown chunks while the slides are read, so each chunk is returned as soon as its slide has been read. The chunks match PowerPointExtractionExtensions.ExtractMarkdownChunks for the same presentation.

Parameters

extract OfficeIMO.PowerPoint.PowerPointExtractionExtensions.PowerPointExtractOptions? = null optional
Notes, tables, hidden shapes and Markdown options.
chunking OfficeIMO.PowerPoint.PowerPointExtractChunkingOptions? = null optional
Chunk size options.
sourcePath string? = null optional
Optional source path used in chunk identifiers and locations.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation checked between slides and shapes.

Returns

IEnumerable<PowerPointExtractChunk>
Open 4 overloads
public static PowerPointSlideReader Open(string path) #

Opens a presentation file for streaming slide reads with the default input limits.

Parameters

path string required
Path to an Open XML presentation.
public static PowerPointSlideReader Open(Stream stream) #

Opens a presentation stream for streaming slide reads with the default input limits.

Parameters

stream System.IO.Stream required
Readable presentation stream; see PowerPointSlideReader.Open.
public static PowerPointSlideReader Open(string path, PowerPointLoadOptions? options, CancellationToken cancellationToken) #

Opens a presentation file for streaming slide reads.

Parameters

path string required
Path to an Open XML presentation.
options OfficeIMO.PowerPoint.PowerPointLoadOptions? required
Input limits: PowerPointLoadOptions.MaxInputBytes, DocumentLoadOptions.PackageSecurity and OfficeOpenXmlLoadSettings.MaxCharactersInPart apply as they do to a model load. Passwords and binary PPT input are not supported.
cancellationToken System.Threading.CancellationToken required
Cancellation for opening the package.
public static PowerPointSlideReader Open(Stream stream, PowerPointLoadOptions? options, CancellationToken cancellationToken) #

Opens a presentation stream for streaming slide reads.

Parameters

stream System.IO.Stream required
Readable presentation stream. A seekable stream is read in place and must stay open and unchanged while the reader is used; a forward-only stream is first copied to memory within PowerPointLoadOptions.MaxInputBytes.
options OfficeIMO.PowerPoint.PowerPointLoadOptions? required
Input limits, as for PowerPointSlideReader.Open.
cancellationToken System.Threading.CancellationToken required
Cancellation for opening the package.
public IEnumerable<PowerPointSlideContent> ReadSlides(bool includeNotes = true, CancellationToken cancellationToken = default) #

Reads slides in presentation order. Each slide is read when the enumerator reaches it; nothing is kept after it is returned.

Parameters

includeNotes bool = true optional
Reads each slide's speaker notes part. Default: true.
cancellationToken System.Threading.CancellationToken = default optional
Cancellation checked between slides and shapes.

Returns

IEnumerable<PowerPointSlideContent>

Properties

public int SlideCount { get; } #

Number of slides in presentation order.