【发布时间】:2022-11-07 07:50:44
【问题描述】:
我正在使用 excel dart 包来创建和编辑 excel 文件。
我试图通过为 excel 单元格提供颜色来使我的 excel 文件看起来更有吸引力。
我阅读了文档here 并尝试这样做:
CellStyle color1 = CellStyle(
fontColorHex: "#Ffffff",
backgroundColorHex: "#80ff00",
fontFamily: getFontFamily(FontFamily.Calibri),
);
CellStyle color2 = CellStyle(
fontColorHex: "#Ffffff",
backgroundColorHex: "#Ea4a73",
fontFamily: getFontFamily(FontFamily.Calibri),
);
var cell = sheetObject.cell(CellIndex.indexByString("A1"));
//changing cell style to color 1
cell.CellStyle = color1;
//now again changing cell style to color 2
cell.CellStyle = color2;
这个问题:当我尝试将 cellStyle 更改为颜色2它坚持旧的价值观颜色1.为什么会发生这种情况,我该如何解决这个问题,是否有任何属性可以先删除 cellStyle,然后分配给新的 CellStyle。提前致谢
【问题讨论】:
标签: android excel flutter dart