jmcnamara / rust_xlsxwriter

A Rust library for creating Excel XLSX files.
https://crates.io/crates/rust_xlsxwriter
Apache License 2.0
353 stars 25 forks source link

question: Vec<CustomStruct> for headers and data? #54

Closed cchance27 closed 1 year ago

cchance27 commented 1 year ago

Question

Is there a way to serialize a vec to a xlsx data table? I was looking through the documentation but it seems only to be possible from arrays and things that are iters, I imagine there should be a way to serialize a vec into a table but it's evading me.

jmcnamara commented 1 year ago

Is there a way to serialize a vec to a xlsx data table?

Could you give an example of a data structure you want to serialize. Also when you say "data table" do you mean a worksheet or a worksheet table.

cchance27 commented 1 year ago

Basically just a struct example:

{ Column1: size,Column2: usize}
let data = Vec![example { Column1: 0, Column:2 }, example { Column1: 3, Column:4}];

Basically a way to turn the above data into an excel worksheet with first row headers Column1, Column2… followed by data rowsPardon my reply being poorly formatted responding from mail on my phone.

jmcnamara commented 1 year ago

Thanks.

Would serde style serialization meet you needs? I'm probably going to implement that as the next major feature. See also #50

jmcnamara commented 1 year ago

Closing this because it will probably be covered by #50, when complete.

jmcnamara commented 12 months ago

Would the following work for your use case: WIP and RFC: Initial support for Serde serialization #61