Crate xlsxwriter
source ·Expand description
§xlsxwriter-rs
Rust binding of libxlsxwriter.
If you are looking for native rust port of libxlsxwriter, please try rust_xlsxwriter which is developed by original libxlsxwriter author.
** API of this library is not stable. **
§Supported Features
- 100% compatible Excel XLSX files.
- Full Excel formatting.
- Merged cells.
- Autofilters.
- Table.
- Conditional Format.
- Validation.
- Data validation and drop down lists.
- Worksheet PNG/JPEG images.
- Cell comments.
§Coming soon
- Charts.
§Examples
use xlsxwriter::prelude::*;
let workbook = Workbook::new("simple1.xlsx")?;
let mut sheet1 = workbook.add_worksheet(None)?;
sheet1.write_string(0, 0, "Red text", Some(&Format::new().set_font_color(FormatColor::Red)))?;
sheet1.write_number(0, 1, 20., None)?;
sheet1.write_formula_num(1, 0, "=10+B1", None, 30.)?;
sheet1.write_url(
1,
1,
"https://github.com/informationsea/xlsxwriter-rs",
Some(&Format::new().set_font_color(FormatColor::Blue).set_underline(FormatUnderline::Single)),
)?;
sheet1.merge_range(2, 0, 3, 2, "Hello, world", Some(
&Format::new().set_font_color(FormatColor::Green).set_align(FormatAlignment::CenterAcross)
.set_vertical_align(FormatVerticalAlignment::VerticalCenter)))?;
sheet1.set_selection(1, 0, 1, 2);
sheet1.set_tab_color(FormatColor::Cyan);
workbook.close()?;
Please read original libxlsxwriter document for description missing functions. Most of this document is based on libxlsxwriter document.
§Migration Guide
§Upgrade from prior version 0.5
- Replace
use xlsxwriter::*
withuse xlsxwriter::prelude::*
- Use
Format::new
instead ofWorkbook::add_format
Format
object’s methods now return mutable reference. Please rewrite code to adopt this change.- Some functions now return
Result<T, XlsxError>
. Please rewrite code to adopt this change.
Re-exports§
Modules§
- Manipulate Charts.
- Manipulate Formats.
- xlsxwriter prelude.
- Manipulate Workbook.
- Manipulate Worksheets.
Structs§
- The error types for xlsxwriter.
Enums§
- String value or float number value