const setSpreadTableStyle = (sheet: any, rowCount: number, columnCount: number) => {
let style = new GC.current.Spread.Sheets.Style();
spread.current.suspendPaint();
for (let i = 0; i < rowCount; i++) {
for (let j = 0; j < columnCount - 1; j++) {
if (i === 0) {
style.font = "bold normal 15px normal";
style.hAlign = GC.current.Spread.Sheets.HorizontalAlign.center;
style.vAlign = GC.current.Spread.Sheets.VerticalAlign.center;
sheet.setStyle(0, 0, style, GC.current.Spread.Sheets.SheetArea.viewport);
sheet.addSpan(0, 0, 1, columnCount);
sheet.addSpan(1, 0, 1, columnCount);
}
if (i === 2) {
// style.font = "bold normal 15px normal";
style.hAlign = GC.current.Spread.Sheets.HorizontalAlign.right;
style.vAlign = GC.current.Spread.Sheets.VerticalAlign.right;
sheet.setStyle(2, 4, style, GC.current.Spread.Sheets.SheetArea.viewport);
sheet.addSpan(2, 4, 1, columnCount);
}
if (i === 3) {
// style.font = "bold normal 15px normal";
style.hAlign = GC.current.Spread.Sheets.HorizontalAlign.center;
style.vAlign = GC.current.Spread.Sheets.VerticalAlign.center;
sheet.setStyle(i, j, style, GC.current.Spread.Sheets.SheetArea.viewport);
let cell = sheet.getCell(i, j, GC.current.Spread.Sheets.SheetArea.viewport);
cell.hAlign(GC.current.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.current.Spread.Sheets.VerticalAlign.center);
}
if (i >= 4 && j >= 2) {
let cell = sheet.getCell(i, j, GC.current.Spread.Sheets.SheetArea.viewport);
cell.hAlign(GC.current.Spread.Sheets.HorizontalAlign.right);
cell.vAlign(GC.current.Spread.Sheets.VerticalAlign.right);
const currentCellValue = sheet.getValue(i, j);
sheet.setValue(i, j, numberFormat_S(UnitType.Individual,currentCellValue,'0,0.00'));
}
}
}
spread.current.resumePaint();
};
|