Bug: serialized fields are not skipped correctly
jmcnamara opened this issue · 0 comments
jmcnamara commented
Current behavior
Skipping serialized fields with rust_xlsxwriter
methods (but not with serde) creates non-contiguous headers. See the example below.
Sample code to reproduce
use rust_xlsxwriter::{Workbook, XlsxError, XlsxSerialize};
use serde::Serialize;
fn main() -> Result<(), XlsxError> {
let mut workbook = Workbook::new();
// Add a worksheet to the workbook.
let worksheet = workbook.add_worksheet();
// Create a serializable struct.
#[derive(XlsxSerialize, Serialize)]
struct Produce {
column1: f64,
column2: f64,
#[xlsx(skip)]
column3: f64,
column4: f64,
}
// Set the serialization location and headers.
worksheet.set_serialize_headers::<Produce>(0, 0)?;
// Save the file to disk.
workbook.save("serialize.xlsx")?;
Ok(())
}
Environment
- `rust_xlsxwriter` version: 0.61.0