excel模板中设置了页眉和页脚,用spreadjs导入后再打印,页眉页脚没有了
var spread = new GC.Spread.Sheets.Workbook(document.getElementById("printArea1"));
var excelIo = new GC.Spread.Excel.IO();
var excelFilePath = "http://localhost:5002/EXCEL/555.xlsx";
var xhr = new XMLHttpRequest();
xhr.open('GET', excelFilePath, true);
xhr.responseType = 'blob';
xhr.onload = function (e) {
if (this.status == 200) {
// get binary data as a response
var blob = this.response;
// convert Excel to JSON
excelIo.open(blob, function (json) {
var workbookObj = json;
spread.fromJSON(workbookObj);
}, function (e) {
// process error
alert(e.errorMessage);
}, {});
}
};
xhr.send();
document.getElementById('print1').onclick = function () {
var sheet = spread.sheets[0];
var printInfo = sheet.printInfo();
printInfo.showRowHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
printInfo.showColumnHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
printInfo.margin({ top: 1, bottom: 1, left: 1, right: 1, header: 0.5, footer: 0.5 });
printInfo.showBorder(false);
spread.print(0);
};
导入后 页眉页脚没有了
|