9 releases (stable)
1.1.7 | Jun 22, 2024 |
---|---|
1.1.5 | Apr 11, 2023 |
1.1.4 | Aug 19, 2022 |
1.1.1 | Jul 13, 2021 |
0.8.7 | Nov 17, 2019 |
#201 in Compression
26,779 downloads per month
Used in 14 crates
(via xlsxwriter)
2MB
42K
SLoC
Contains (Cab file, 16KB) vbaProject.bin, (obscure autoconf code, 1KB) configure.ac
xlsxwriter-rs
Rust binding of libxlsxwriter
Supported Features
- 100% compatible Excel XLSX files.
- Full Excel formatting.
- Merged cells.
- Autofilters.
- Data validation and drop down lists.
- Worksheet PNG/JPEG images.
Coming soon
- Charts.
Feature Flags
no-md5
: Disable image de-duplication and remove md5 function. (See upstream document to learn more).use-openssl-md5
: Use OpenSSL implementation of md5 function. (See upstream document to learn more).system-zlib
: Use system zlib instead of included zlib.
Build requirements
- LLVM and clang
How to build on windows
- Install Visual Studio
- Install LLVM
- Set environment variable
LIBCLANG_PATH
asC:\Program Files\LLVM\bin
- Run build
Example
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()?;
Run Example with Cargo
You can explore this example locally following the steps below:
- Install LLVM and set LIBCLANG_PATH if you are using windows. (see bindgen doc for details)
- clone or fork this repository
git submodule update --init --recursive
- The above command downloads the required C library so we can compile
cargo run --example hello_spreadsheet
You should then see the example in target/simple1.xlsx
. Enjoy!