Skip to content

This content is for v4.x (Alpha). Switch to the Stable version.

The official release Crate package for openxml-office on Crates.io:

PackageMaintenanceCurrent Stable ReleaseCurrent Alpha Release
draviavemal-openxml_officeActivebadgebadge

The library is available on crates.io. You can install it using the following command

Terminal window
#Using Package Manager
cargo add draviavemal-openxml_office
Terminal window
# Cargo.toml add below details
draviavemal-openxml_office = "4.0.0-alpha.5"

Once Installed the package should be direct use available like below example. More samples can be seen in test projectโ€™s of the repo or check other parts of the documents

// Create new Excel File in memory
let mut file = crate::spreadsheet_2007::Excel::new(
None,
crate::spreadsheet_2007::ExcelPropertiesModel::default(),
).context("Create New File Failed")?;
// Save the created file in destination path
file.save_as("result.xlsx").context("Save File Failed")?;
// Create new Presentation File in memory
let file = crate::presentation_2007::PowerPoint::new(
None,
crate::presentation_2007::PowerPointPropertiesModel::default(),
).context("Create New File Failed");
// Save the created file in destination path
file.save_as(&get_save_file(None)).context("Failed to save Empty Power Point");
// Create new Word File in memory
let file = crate::document_2007::Word::new(
None,
crate::document_2007::WordPropertiesModel::default()
).context("Create New File Failed");
// Save the created file in destination path
file.save_as(&get_save_file(None)).context("Save Result Failed");