기타 Excel export 문의
페이지 정보
작성자 GoodPlum 작성일 2023-08-22 10:21 조회 477회 댓글 0건본문
관련링크
안녕하세요.
ExcelIO 및 json을 이용해 spread를 엑셀로 export하는걸 구현중에 있습니다.
현재 엑셀 export는 구현이 된 상황인데 추가적인 기능에 관해 문의 드립니다.
1. 엑셀로 export를 하면 엑셀에 시트 번호가 표시가 안됩니다.(시트번호 자체가 표시안된 상태로 저장이 됩니다.)
spread를 toJSON을 통해 변환 할 때 어떤 옵션을 줘야하는지 문의 드립니다.
2. 화면에 여러 spread(spread가 2개 이상)가 있을 때 하나의 엑셀 파일에 시트별로해서 spread 내용을 저장 하고 싶습니다.
관련하여 샘플 요청 드립니다.
아래는 현재 제가 구현한 스크립트 입니다.
function jsonToExcel(fileName) {
let workbook = GC.Spread.Sheets.findControl(document.getElementById("fpSpread"));
//console.log(workbook);
let excelIO = new GC.Spread.Excel.IO();
if(fileName.substr(-5, 5) !== '.xlsx') {
fileName += '.xlsx';
}
//console.log('fileName : ' + fileName);
var serializationOption = {
includeBindingSource: true // include binding source when converting the workbook to json, default value is false
//ignoreStyle: true, // ignore styles when converting workbook to json, default value is false
//ignoreFormula: true, // ignore formulas when converting workbook to json, default value is false
//saveAsView: true, //include the format string formatting result when converting workbook to json, default value is false
//rowHeadersAsFrozenColumns: true, // treat row headers as frozen columns when converting workbook to json, default value is false
, columnHeadersAsFrozenRows: true // treat column headers as frozen rows when converting workbook to json, default value is false
//includeAutoMergedCells: true, // include the automatically merged cells to the real merged cells when converting the workbook to json.
}
let json = workbook.toJSON(serializationOption);
var str = JSON.stringify(json);
//console.log('data : ' + str);
excelIO.save(str, function (blob) {
saveAs(blob, fileName);
}, function (e) {
console.log(e);
});
}
감사합니다.
댓글목록
등록된 댓글이 없습니다.