excel里面是这样的:
spreedjs展现是这样:
我的版本是18.0.5,app.js代码如下:
import * as GC from "@grapecity-software/spread-sheets";
import "@grapecity-software/spread-sheets-io";
import "@grapecity-software/spread-sheets-print";
import "@grapecity-software/spread-sheets-pdf";
import "@grapecity-software/spread-sheets-resources-zh";
GC.Spread.Common.CultureManager.culture("zh-cn");
let spread_result = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
let spread_calc = new GC.Spread.Sheets.Workbook();
let xhr = new XMLHttpRequest();
xhr.open("get", "./static/法务月报_2025-05-27_080629 (3).xlsx")
xhr.responseType = "blob"
var CenterDiv = $(".center");
document.getElementById("ZZ").style.display = "block";
show(CenterDiv);
xhr.addEventListener("loadend", function () {
if (this.readyState == 4 && this.status == 200) {
let file = new File([this.response], "")
spread_result.import(file, function () {
let sheet = spread_result.getActiveSheet();
// sheet.options.gridline.showHorizontalGridline = true;
// sheet.options.gridline.showVerticalGridline = true;
let pi = sheet.printInfo();
pi.showGridLine(true);
//spread_result.calculate(GC.Spread.Sheets.CalculationType.all, "Sheet1"); // The Sheet1!A1 will generate a new random number, but Sheet2!A1 keeps th old value. Sheet2!A2 keeps the old value when it's in manual calculation mode.
spread_result.calculate();
hide(CenterDiv);
document.getElementById("ZZ").style.display = "none";
}, function () { }, {
fileType: GC.Spread.Sheets.FileType.excel
})
}
})
xhr.send();
function show(elemSelector) {
elemSelector.show();
elemSelector.css({
position: "fixed",
_position: "absolute",
margin: "auto",
top: "0",
left: "0",
right: "0",
bottom: "0",
"z-index": "9999",
});
}
function hide(elemSelector) {
elemSelector.hide();
}
|