JavaScript
const spread = new GC.Spread.Sheets.Workbook(document.getElementById('spreadContainer'));
const sheet = spread.getActiveSheet();
spread.options.tabStripVisible = false;
sheet.suspendPaint();
const colWidths = [170, 115, 150, 115];
colWidths.forEach((w, i) => sheet.setColumnWidth(i, w));
sheet.setRowHeight(0, 38);
const headers = ['비용 항목', '자체 개발', '오픈소스(Luckysheet)', 'SpreadJS'];
headers.forEach((h, c) => {
sheet.setValue(0, c, h);
const cell = sheet.getCell(0, c);
cell.backColor('#1a3a5c').foreColor('#ffffff').font('bold 12px sans-serif');
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
});
const rows = [
['초기 개발 공수', '12~18 M/M', '6~8 M/M', '2~3 M/M'],
['초기 개발 비용(만원)', '9,600', '4,800', '1,600'],
['라이선스/년(만원)', '0', '0', '500~800'],
['유지보수 공수/년', '3~4 M/M', '4~6 M/M', '0.5~1 M/M'],
['유지보수 비용/년(만원)', '2,400', '3,600', '600'],
['사용자 교육비(만원)', '2,000~4,000', '1,500~3,000', '거의 없음'],
['3년 누적 TCO(만원)', '21,600+', '18,000+', '4,900~6,000'],
];
const stripes = ['#f0f4ff', '#ffffff'];
rows.forEach((row, r) => {
sheet.setRowHeight(r + 1, 32);
const isSummary = r === rows.length - 1;
row.forEach((val, c) => {
sheet.setValue(r + 1, c, val);
const isSpreadJS = c === 3;
let bg, fg;
if (isSummary) {
bg = isSpreadJS ? '#2e7d32' : c === 0 ? '#37474f' : '#c62828';
fg = '#ffffff';
} else {
bg = isSpreadJS ? '#e8f5e9' : stripes[r % 2];
fg = isSpreadJS ? '#1b5e20' : '#333333';
}
const cell = sheet.getCell(r + 1, c);
cell.backColor(bg).foreColor(fg);
if (isSummary) cell.font('bold 12px sans-serif');
cell.hAlign(c === 0 ? GC.Spread.Sheets.HorizontalAlign.left : GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
});
});
const border = new GC.Spread.Sheets.LineBorder('#cfd8e8', GC.Spread.Sheets.LineStyle.thin);
for (let r = 0; r <= rows.length; r++) {
for (let c = 0; c < 4; c++) {
sheet.getCell(r, c).borderBottom(border).borderRight(border);
}
}
sheet.setRowCount(rows.length + 1);
sheet.options.rowHeaderVisible = false;
sheet.options.colHeaderVisible = false;
sheet.resumePaint();