let getExcel2 = function (data) { //Todo: 컴퍼넌트. 주석 삭제하지 말자 let sheet_title = "검사항목"; let file_name = "검사항목"; const work_Book = new ExcelJS.Workbook(); // ExcelJS 라이브러리로 새 워크북 생성 const work_Sheet = work_Book.addWorksheet(sheet_title); // 새 워크시트 추가 const all_border = { top: { style: "thin", color: { argb: "FF000000" } }, left: { style: "thin", color: { argb: "FF000000" } }, bottom: { style: "thin", color: { argb: "FF000000" } }, right: { style: "thin", color: { argb: "FF000000" } }, }; const field_css = { yellow: { border: all_border, font: { color: { argb: "FF9C5700" }, bold: true }, alignment: { vertical: "middle", horizontal: "center" }, fill: { type: "pattern", pattern: "solid", fgColor: { argb: "FFFFEB9C" }, }, }, green: { border: all_border, font: { color: { argb: "FF006100" }, bold: true }, alignment: { vertical: "middle", horizontal: "center" }, fill: { type: "pattern", pattern: "solid", fgColor: { argb: "FFC6EFCE" }, }, }, red: { border: all_border, font: { color: { argb: "FF9C0006" }, bold: true }, alignment: { vertical: "middle", horizontal: "center" }, fill: { type: "pattern", pattern: "solid", fgColor: { argb: "FFFFC7CE" }, }, }, blue: { border: all_border, font: { font: { size: 11 }, color: { argb: "0E3979" }, bold: true }, alignment: { vertical: "middle", horizontal: "center" }, fill: { type: "pattern", pattern: "solid", fgColor: { argb: "EAEFF3" }, } }, title: { font: { size: 15, bold: true }, alignment: { vertical: "middle", horizontal: "center" }, }, box: { border: all_border, alignment: { vertical: "middle", horizontal: "center" }, font: { size: 11 }, }, }; // // 첫 번째 행 설정, 높이와 제목 설정 // let ws_row1 = work_Sheet.getRow(1); // ws_row1.height = 32; // ws_row1.getCell(1).value = "검사항목"; // ws_row1.getCell(1).style = field_css.title // work_Sheet.mergeCells('A1:E1'); let ws_row = work_Sheet.getRow(1); ws_row.height = 25; // ws_row.getCell(1).style = field_css.blue; // ws_row.getCell(1).value = "NO."; ws_row.getCell(1).style = field_css.blue; ws_row.getCell(1).value = "검사항목"; ws_row.getCell(2).style = field_css.blue; ws_row.getCell(2).value = "검사항목명"; ws_row.getCell(3).style = field_css.blue; ws_row.getCell(3).value = "검사유형"; ws_row.getCell(4).style = field_css.blue; ws_row.getCell(4).value = "사용"; work_Sheet.columns = [ { width: 15 }, { width: 30 }, { width: 15 }, { width: 15 }, { width: 9 }, ]; // 파일 생성 및 다운로드 부분 work_Book.xlsx.writeBuffer().then((data) => { const blob = new Blob([data], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", }); const url = window.URL.createObjectURL(blob); const anchor = document.createElement("a"); anchor.href = url; anchor.download = file_name; anchor.click(); window.URL.revokeObjectURL(url); }); }