기타 excel export 데이터 문의
페이지 정보
작성자 Nope 작성일 2022-11-03 16:44 조회 555회 댓글 0건본문
관련링크
excel export 시 데이터 누락 문의
데이터는 setdatasource를 통해 아래와 같이 spread상에 바인딩 되어 있습니다.
아래와 같이 excel export 를 하려 합니다.
====================================================================
SaveExcel= function (host, fileName) {
var spread = GC.Spread.Sheets.findControl(host);
var excelIO = new GC.Spread.Excel.IO();
if (spread) {
if (fileName.substr(-5, 5) != '.xlsx') {
fileName += '.xlsx';
}
//var json = spread.toJSON();
var json = JSON.stringify(spread.toJSON());
excelIO.save(json, function (blob) {
saveAs(blob, fileName);
}, function (e) {
// process error
console.log(e);
});
}
}
===================================================================
excelio를 통해 정상적으로 다운은 되지만 데이터는 나오지 않습니다.
sheet.options.gridline.showHorizontalGridline = false;
sheet.options.gridline.showVerticalGridline = false;
옵션이 있어 spread의 스타일까지는 정상적으로 export되는 것 같습니다만 data만 입력이 되지 않습니다.
바인딩이 문제가 될까 싶어 아래와 같이 setvalue, settext로 강제로 데이터를 입력한 후 export해도 동일합니다.
====================================================================
SaveExcel= function (host, fileName) {
var spread = GC.Spread.Sheets.findControl(host);
var excelIO = new GC.Spread.Excel.IO();
if (spread) {
if (fileName.substr(-5, 5) != '.xlsx') {
fileName += '.xlsx';
}
var sheet = spread.getSheet(0);
sheet.setValue(0, 0, "11");
sheet.setText(0, 1, "22");
//var json = spread.toJSON();
var json = JSON.stringify(spread.toJSON());
excelIO.save(json, function (blob) {
saveAs(blob, fileName);
}, function (e) {
// process error
console.log(e);
});
}
}
==============================================================================
이와 같은 문의 드립니다.
감사합니다.
댓글목록
등록된 댓글이 없습니다.