本帖最后由 Matthew.Xue 于 2025-4-3 09:26 编辑
1、我不想默认把sheet保护起来,可以修改导出的配置吗?
2、我怕没有新增任何的样式文件,就是通过export保存的集算表excel再import进入
- //保存集算表window.saveSupplyTable = function(type) {
- spread.export(
- function (blob) {
- var fdName = $("input[name='fdName']").val();
- var fdId = $("input[name='fdId']").val();
- if(fdId !="") {
- sendFileToServer(blob, fdName, fdId);
- }
- },
- function (err) {
- console.error('导出文件时发生错误:', err);
- },
- {
- includeUnusedNames: false,
- fileType: GC.Spread.Sheets.FileType.excel,
- includeBindingSource:true,
- saveAsView:true
- } // 保存选项
- );
- }//加载集算表function loadSpreadJs(fdId) {
- var url = '${LUI_ContextPath}/zwbdt/spreadjs/spreadjs_supply/zwbdtSpreadJsSupply.do?method=getTableData&fdId=' + encodeURIComponent(fdId);
- fetch(url)
- .then((response) => {
- if (!response.ok) {
- throw new Error('Network response was not ok ' + response.statusText);
- }
- return response.blob();
- })
- .then((blob) => {
- // 创建新的 Blob 对象,设置 MIME 类型为 application/zip
- let file = new File([blob], "test.xlsx")
- // 打开文件
- spread.import(file, function () {
- console.log('文件导入成功');
- }, function (e) {
- console.log('错误', e); // 错误回调
- },{
- fileType: GC.Spread.Sheets.FileType.excel
- });
- })
- .catch((error) => {
- console.log('网络请求或文件处理失败或文件为空:', error);
- });
- }
复制代码
|
|