GridJs サーバー側での作業

GridJs サーバー側での作業

0. Config で正しいフォルダー パスを設定します。

**Config.FileCacheDirectory**ワークブックキャッシュファイル用。 **Config.PictureCacheDirectory**ワークブック内の画像ファイルのキャッシュ用。

保管の詳細については、こちらをご確認くださいガイド

1. GridCacheForStream を実装する

ローカル ファイル ストレージの例は次のとおりです。

サーバー側ストレージの例も提供します。 チェックしてください:https://github.com/aspose-cells/Aspose.Cells-for-.NET/blob/master/Examples_GridJs/Models/AwsCache.cs

2. スプレッドシート ファイルから json を取得します。

GridJsWorkbook wbj = new GridJsWorkbook();
using (FileStream fs = new FileStream(path, FileMode.Open))
{
    wbj.ImportExcelFile(fs,GridJsWorkbook.GetGridLoadFormat(Path.GetExtension(path)));
}
String ret =wbj.ExportToJson();

3. スプレッドシート ファイルから画像/形状を取得します

//Gridjs will automatically zip all the images/shapes into a zip stream  and store it in cache using the cache implemention.
//GridJsWorkbook.CacheImp.SaveStream(zipoutStream, fileid);

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

//get the zip file stream by the fileid
Stream s=GridJsWorkbook.CacheImp.LoadStream(fileid), mimeType, fileid.Replace('/', '.')

4. キャッシュ内のスプレッドシート ファイルを更新する

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

5. スプレッドシート ファイルをキャッシュに保存する

GridJsWorkbook wb = new GridJsWorkbook();
//p is the update json,uid is the unique id for the spreadsheet
wb.MergeExcelFileFromJson(uid, p);
wb.SaveToCacheWithFileName(uid, filename,password);

詳細については、ここで例を確認できます。 https://github.com/aspose-cells/Aspose.Cells-for-.NET/tree/master/Examples_GridJs