JavaScript
const spread = new GC.Spread.Sheets.Workbook(document.getElementById('spreadContainer'));
spread.options.useTouchLayout = true;
spread.options.tabStripVisible = false;
const sheet = spread.getActiveSheet();
sheet.setColumnCount(6);
const headers = ['품목코드', '품목명', '단위', '현재고', '입고수량', '출고수량'];
headers.forEach((h, c) => {
sheet.setValue(0, c, h);
sheet.getCell(0, c).backColor('#1565C0').foreColor('#fff').font('bold 13px sans-serif').hAlign(1);
sheet.setColumnWidth(c, c === 1 ? 120 : 90);
});
sheet.setRowHeight(0, 40);
const items = [
['P-001', '나사 M6×20', 'EA', 1500, 200, 150],
['P-002', '너트 M6', 'EA', 3200, 500, 320],
['P-003', '와셔 6mm', 'EA', 2800, 300, 180],
['P-004', '볼트 M8×30', 'EA', 980, 100, 200],
['P-005', '스프링 핀 Ø6', 'EA', 450, 50, 80],
];
items.forEach((row, r) => {
row.forEach((val, c) => {
sheet.setValue(r + 1, c, val);
if (c >= 3) sheet.getCell(r + 1, c).formatter('#,##0').hAlign(3);
});
const bg = r % 2 === 0 ? '#F5F9FF' : '#FFFFFF';
for (let c = 0; c < 6; c++) sheet.getCell(r + 1, c).backColor(bg);
sheet.setRowHeight(r + 1, 36);
// 현재고 부족 경고 (1000 미만)
if (row[3] < 1000) sheet.getCell(r + 1, 3).backColor('#FFF3E0').foreColor('#E65100');
});
const msg = document.getElementById('statusMsg');
if (msg) msg.textContent = 'useTouchLayout 활성화 — 터치 제스처를 사용해 보세요.';