pub struct Document { /* private fields */ }
Expand description
A Wrapper for the LibreOfficeKitDocument
C API.
Implementations§
Source§impl Document
impl Document
Sourcepub fn save_as(&mut self, url: &str, format: &str, filter: Option<&str>) -> bool
pub fn save_as(&mut self, url: &str, format: &str, filter: Option<&str>) -> bool
Stores the document’s persistent data to a URL and continues to be a representation of the old URL.
If the result is not true, then there’s an error (possibly unsupported format or other errors)
§Arguments
url
- the location where to store the documentformat
- the format to use while exporting, when omitted, then deducted from pURL’s extensionfilter
- options for the export filter, e.g. SkipImages.Another useful FilterOption is “TakeOwnership”. It is consumed by the saveAs() itself, and when provided, the document identity changes to the provided pUrl - meaning that ‘.uno:ModifiedStatus’ is triggered as with the “Save As…” in the UI. “TakeOwnership” mode must not be used when saving to PNG or PDF.
§Example
use libreoffice_rs::Office;
use libreoffice_rs::urls;
let mut office = Office::new("/usr/lib/libreoffice/program")?;
let doc_url = urls::local_into_abs("./test_data/test.odt")?;
let mut doc = office.document_load(doc_url)?;
let output_path = std::env::temp_dir().join("libreoffice_rs_save_as.png");
let output_location = output_path.display().to_string();
let previously_saved = doc.save_as(&output_location, "png", None);
let _ = std::fs::remove_file(&output_path);
assert!(previously_saved, "{}", office.get_error());
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl !Send for Document
impl !Sync for Document
impl Unpin for Document
impl UnwindSafe for Document
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more