JavaScript
var salesData = [
{ product: '갤럭시 탭', category: '태블릿', quantity: 85, revenue: 51000000, date: new Date(2024, 0, 15) },
{ product: '맥북 프로', category: '노트북', quantity: 42, revenue: 84000000, date: new Date(2024, 0, 22) },
{ product: '아이패드', category: '태블릿', quantity: 110, revenue: 77000000, date: new Date(2024, 1, 3) },
{ product: '서피스 프로', category: '노트북', quantity: 37, revenue: 55500000, date: new Date(2024, 1, 14) },
{ product: '갤럭시 워치', category: '웨어러블', quantity: 230, revenue: 34500000, date: new Date(2024, 2, 5) },
{ product: '에어팟 프로', category: '오디오', quantity: 190, revenue: 28500000, date: new Date(2024, 2, 18) },
{ product: '스마트 TV', category: '가전', quantity: 28, revenue: 42000000, date: new Date(2024, 3, 2) },
{ product: '로봇 청소기', category: '가전', quantity: 65, revenue: 32500000, date: new Date(2024, 3, 20) },
];
var grid = new wijmo.grid.FlexGrid('#salesGrid', {
itemsSource: new wijmo.collections.CollectionView(salesData),
isReadOnly: true,
columns: [
{ binding: 'product', header: '제품명', width: 140 },
{ binding: 'category', header: '카테고리', width: 110 },
{ binding: 'quantity', header: '판매량', width: 90, format: 'n0' },
{ binding: 'revenue', header: '매출(원)', width: 130, format: 'n0' },
{ binding: 'date', header: '날짜', width: 120, format: 'yyyy-MM-dd' }
]
});
function exportToExcel() {
wijmo.grid.xlsx.FlexGridXlsxConverter.save(
grid,
{ includeColumnHeaders: true },
'판매현황.xlsx'
);
}
window.exportToExcel = exportToExcel;