pub struct Document { /* private fields */ }Expand description
An open presentation.
Implementations§
Source§impl Document
impl Document
Sourcepub fn from_source(source: Arc<dyn Source>) -> Result<Self>
pub fn from_source(source: Arc<dyn Source>) -> Result<Self>
Opens a deck over any positioned source: a package, or a compound file holding a legacy binary presentation. Encrypted files are refused.
Sourcepub fn from_legacy(deck: Arc<LegacyDeck>) -> Self
pub fn from_legacy(deck: Arc<LegacyDeck>) -> Self
A document over a parsed legacy deck; slides map onto the same model.
pub fn from_package(package: Package) -> Result<Self>
Sourcepub fn core_properties(&self) -> Result<Option<CoreProperties>>
pub fn core_properties(&self) -> Result<Option<CoreProperties>>
The Core Properties part (docProps/core.xml), when the package has one.
Sourcepub fn app_properties(&self) -> Result<Option<AppProperties>>
pub fn app_properties(&self) -> Result<Option<AppProperties>>
The Extended Properties part (docProps/app.xml), when the package has one.
Sourcepub fn sections(&self) -> Vec<SlideSection>
pub fn sections(&self) -> Vec<SlideSection>
The deck’s sections (PowerPoint 2010 p14:sectionLst) with their
slides as zero-based indexes; empty when the deck has none.
Every comment author the presentation part links to, both flavours; unreadable authors parts count as empty.
Sourcepub fn threads(&self) -> usize
pub fn threads(&self) -> usize
The worker limit for Document::map_slides; 0 means every core.
Sourcepub fn set_threads(&mut self, threads: usize)
pub fn set_threads(&mut self, threads: usize)
Limits Document::map_slides to threads workers; 0 restores every
core for a package and the calling thread for a legacy deck, whose
slides are too cheap to spread.
Sourcepub fn with_threads(self, threads: usize) -> Self
pub fn with_threads(self, threads: usize) -> Self
Builder form of Document::set_threads.
Sourcepub fn seed(&self) -> DocumentSeed
pub fn seed(&self) -> DocumentSeed
A handle that can cross threads.
Sourcepub fn from_seed(seed: DocumentSeed) -> Self
pub fn from_seed(seed: DocumentSeed) -> Self
A document over the same archive and presentation, with its own caches.
Sourcepub fn package(&self) -> Option<&Package>
pub fn package(&self) -> Option<&Package>
The package behind a PresentationML deck; None for a legacy binary deck.
Sourcepub fn legacy(&self) -> Option<&Arc<LegacyDeck>>
pub fn legacy(&self) -> Option<&Arc<LegacyDeck>>
The parsed legacy deck behind a .ppt file; None for a package.
pub fn presentation(&self) -> &Presentation
Sourcepub fn presentation_part(&self) -> &str
pub fn presentation_part(&self) -> &str
The Presentation part name, usually /ppt/presentation.xml.
pub fn defects(&self) -> &DocumentDefects
Sourcepub fn slide_refs(&self) -> &[SlideRef]
pub fn slide_refs(&self) -> &[SlideRef]
Slides in presentation order.
pub fn slide_count(&self) -> usize
Sourcepub fn slide(&self, index: usize) -> Result<Slide<'_>>
pub fn slide(&self, index: usize) -> Result<Slide<'_>>
Parses slide index (zero-based, presentation order).
Sourcepub fn slides(&self) -> impl Iterator<Item = Result<Slide<'_>>> + '_
pub fn slides(&self) -> impl Iterator<Item = Result<Slide<'_>>> + '_
Every slide in order; a slide that fails to parse yields its error and iteration continues.
Sourcepub fn slide_part(&self, part: &str) -> Result<(SlideContent, SlideReport)>
pub fn slide_part(&self, part: &str) -> Result<(SlideContent, SlideReport)>
Reads and parses any slide-family part by name (layouts, masters, notes).
Sourcepub fn map_slides<T, F>(&self, f: F) -> Vec<T>
pub fn map_slides<T, F>(&self, f: F) -> Vec<T>
Applies f to every slide, spreading slides across the available
cores (see Document::set_threads). Results come back in slide
order. Each worker thread builds its own Document from a seed, so
nothing is shared but the archive.
Sourcepub fn all_slides(&self) -> Vec<usize>
pub fn all_slides(&self) -> Vec<usize>
Every slide index, in presentation order.
Sourcepub fn map_slides_at<T, F>(&self, indices: &[usize], f: F) -> Vec<T>
pub fn map_slides_at<T, F>(&self, indices: &[usize], f: F) -> Vec<T>
Applies f to the slides at indices (zero-based), in the written
order, with the same worker spread as Document::map_slides. An
index past the last slide reaches f as an error.
Sourcepub fn slide_texts(&self, options: &TextOptions) -> (Vec<String>, ExtractReport)
pub fn slide_texts(&self, options: &TextOptions) -> (Vec<String>, ExtractReport)
The text of every slide, in order, plus what was left out.
Sourcepub fn slide_texts_at(
&self,
indices: &[usize],
options: &TextOptions,
) -> (Vec<String>, ExtractReport)
pub fn slide_texts_at( &self, indices: &[usize], options: &TextOptions, ) -> (Vec<String>, ExtractReport)
The text of the slides at indices (zero-based), in the written
order, plus what was left out; failures are reported under the real
slide number.
pub fn text_reporting(&self, options: &TextOptions) -> (String, ExtractReport)
Source§impl Document
impl Document
Sourcepub fn markdown(&self, options: &MarkdownOptions) -> (String, ExtractReport)
pub fn markdown(&self, options: &MarkdownOptions) -> (String, ExtractReport)
The whole deck as Markdown, slides separated by a rule, with what was skipped.
Sourcepub fn markdown_at(
&self,
indices: &[usize],
options: &MarkdownOptions,
) -> (String, ExtractReport)
pub fn markdown_at( &self, indices: &[usize], options: &MarkdownOptions, ) -> (String, ExtractReport)
The slides at indices (zero-based) as Markdown in the written
order, separated by a rule, with what was skipped.