PowerPointSlideReader
OfficeIMO.PowerPoint
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
- Method PowerPointSlideReader.Open
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
- Notes, tables, hidden shapes and Markdown options.
- chunking OfficeIMO.PowerPoint.PowerPointExtractChunkingOptions? = null
- Chunk size options.
- sourcePath string? = null
- Optional source path used in chunk identifiers and locations.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation checked between slides and shapes.
Returns
IEnumerable<PowerPointExtractChunk>public static PowerPointSlideReader Open(string path) #Opens a presentation file for streaming slide reads with the default input limits.
Parameters
- path string
- Path to an Open XML presentation.
Returns
PowerPointSlideReaderpublic static PowerPointSlideReader Open(Stream stream) #Opens a presentation stream for streaming slide reads with the default input limits.
Parameters
- stream System.IO.Stream
- Readable presentation stream; see PowerPointSlideReader.Open.
Returns
PowerPointSlideReaderpublic static PowerPointSlideReader Open(string path, PowerPointLoadOptions? options, CancellationToken cancellationToken) #Opens a presentation file for streaming slide reads.
Parameters
- path string
- Path to an Open XML presentation.
- options OfficeIMO.PowerPoint.PowerPointLoadOptions?
- 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
- Cancellation for opening the package.
Returns
PowerPointSlideReaderpublic static PowerPointSlideReader Open(Stream stream, PowerPointLoadOptions? options, CancellationToken cancellationToken) #Opens a presentation stream for streaming slide reads.
Parameters
- stream System.IO.Stream
- 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?
- Input limits, as for PowerPointSlideReader.Open.
- cancellationToken System.Threading.CancellationToken
- Cancellation for opening the package.
Returns
PowerPointSlideReaderpublic 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
- Reads each slide's speaker notes part. Default: true.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation checked between slides and shapes.
Returns
IEnumerable<PowerPointSlideContent>