wip: preserve the column width when setting style

This commit is contained in:
Jeremy Wall 2025-01-26 19:14:30 -05:00
parent e0c6896d61
commit b6b98bc099

View File

@ -323,9 +323,13 @@ impl Book {
pub fn set_col_style(&mut self, style: &Style, sheet: u32, col: usize) -> Result<()> {
let idx = self.create_or_get_style_idx(style);
self.model.workbook.worksheet_mut(sheet)
.map_err(|e| anyhow!("{}", e))?
.set_column_style(col as i32, idx)
let sheet = self.model.workbook.worksheet_mut(sheet)
.map_err(|e| anyhow!("{}", e))?;
let width = sheet.get_column_width(col as i32)
.map_err(|e| anyhow!("{}", e))?;
sheet.set_column_style(col as i32, idx)
.map_err(|e| anyhow!("{}", e))?;
sheet.set_column_width(col as i32, width)
.map_err(|e| anyhow!("{}", e))?;
Ok(())
}