与GridJs服务器端配合工作

与GridJs服务器端配合工作

1. 在Config中设置正确的文件夹路径

使用Config.set_file_cache_directory来设置缓存路径。

 Config.set_file_cache_directory('c:/storage/cache/')

有关存储详情,请查看此指南

2. 从电子表格文件中获取JSON。

path='c:/files/example.xlsx'
gwb = new GridJsWorkbook();
gwb.ImportExcelFile(path);

ret =gwb.export_to_json();

3. 从电子表格文件中获取图像/形状

# Gridjs will automatically zip all the images/shapes into a zip stream  and store it in cache  


# get the fileid in the cache,uid is the unique id for the spreadsheet  instance, sheetid is the sheet index,
fileid=(uniqueid + '.' + (sheetid + '_batch.zip'))

# get the zip file  by the fileid
os.path.join(Config.file_cache_directory, fileid)

4. 在缓存中更新电子表格文件

gwb = new GridJsWorkbook();
# p is the update json,uid is the unique id for the spreadsheet
ret = gwb.UpdateCell(p, uid);

5. 将电子表格文件保存在缓存中

gwb = new GridJsWorkbook();
# p is the update json,uid is the unique id for the spreadsheet
gwb.merge_excel_file_from_json(uid, p);
gwb.save_to_cache_with_file_name(uid, filename,password);

有关详细信息,请查看此处的示例: https://github.com/aspose-cells/Aspose.Cells-for-.NET/tree/master/Examples_GridJs_Python_Net