informationsea / xlsxwriter-rs

Excel file writer for Rust
https://crates.io/crates/xlsxwriter
Apache License 2.0
265 stars 44 forks source link

workbook_new_opt not implemented for libxlsxwriter #22

Closed kindly closed 3 years ago

kindly commented 3 years ago

For large xslx files is it useful to put constant memory mode on in libxlsxwriter.

To do this you need to call workbook_new_opt instead of workbook_new also passing in the configuration struct. https://libxlsxwriter.github.io/workbook_8h.html#a8ca9bd8c30c618b81ca6180f78b03323

I imagine in https://github.com/informationsea/xlsxwriter-rs/blob/master/libxlsxwriter/src/workbook.rs#L28 a new static method new_with_opt would make sense as it mirrors C api. I imagine bindgen has generated the code in libxlsxwriter_sys making bindings for this function and struct, so "in theory" this looks fairly strait foward.

Nonetheless I have no experiance of any C bindings before but will have a go if the approach is considered right. Also would be very happy for someone else to do it if it quick and easy for them.

informationsea commented 3 years ago

I merged your pull request. Thank you.