UNPKG

evmtools-node

Version:

このライブラリは、プライムブレインズ社で利用している「進捗管理ツール(Excel)」ファイルを読み込み、 プロジェクトの進捗状況や要員別の作業量を可視化するためのライブラリです。

30 lines 1.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createStyles = void 0; const createStyles = (styles) => { // applyStylesが欲しがっている関数を返す return function (instances, workbook, sheetName) { const rowCount = instances.length; const columnNames = Object.keys(instances[0]); const columnCount = columnNames.length; const sheet = workbook.sheet(sheetName); const startCell = sheet.cell(`A$1`); const endCell = startCell.relativeCell(rowCount, columnCount - 1); sheet.range(startCell, endCell).style('fontFamily', 'メイリオ'); // sheet.cell('A1').style('fontFamily', 'メイリオ') const headerStartCell = sheet.cell(`A1`); const headerEndCell = headerStartCell.relativeCell(0, columnCount - 1); sheet .range(headerStartCell, headerEndCell) .style('fill', { type: 'solid', color: { theme: 8, tint: '0.8' } }); if (styles) { styles({ instances, sheet, rowCount, columnCount, columnNames, startCell, endCell }); } // よくある整形パタン。 // sheet.range(`C2:C${rowCount + 1}`).style('numberFormat', '@') // 書式: 文字(コレをやらないと、見かけ上文字だが、F2で抜けると数字になっちゃう) // sheet.range(`E2:F${rowCount + 1}`).style('numberFormat', 'yyyy/mm/dd') // 書式: 日付 // sheet.range(`H2:H${rowCount + 1}`).style('numberFormat', 'yyyy/mm/dd hh:mm') // 書式: 日付+時刻 }; }; exports.createStyles = createStyles; //# sourceMappingURL=styles.js.map