background/background.rs
1use edit_xlsx::{Workbook, WorkbookResult};
2
3fn main() -> WorkbookResult<()> {
4 // Create a new workbook
5 let mut workbook = Workbook::new();
6 // Use the default worksheet
7 let worksheet = workbook.get_worksheet_mut(1)?;
8 // Set the background image.
9 // **NOTICE**: Only png format is acceptable in the background image
10 worksheet.set_background("examples/pics/ferris.png")?;
11
12 workbook.save_as("examples/background.xlsx")?;
13 Ok(())
14}