Skip to main content

OpenFile

Trait OpenFile 

Source
pub trait OpenFile: Sized {
    // Required method
    fn open_file(path: impl AsRef<Path>) -> Result<Self>;
}
Expand description

Reads a Document/Workbook/Presentation directly from a path on disk — word::Document::open_file("report.docx")? instead of manually opening a File and calling the type’s own read_from. For the common case where the caller already knows which format they’re working with; see open for auto-detection.

Required Methods§

Source

fn open_file(path: impl AsRef<Path>) -> Result<Self>

Reads self from the file at path.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl OpenFile for Document

Available on crate feature word only.
Source§

impl OpenFile for Presentation

Available on crate feature powerpoint only.
Source§

impl OpenFile for Workbook

Available on crate feature excel only.