Arbeiten mit GridJs Serverseite

Arbeiten mit GridJs Serverseite

0. Stellen Sie in der Konfiguration den richtigen Ordnerpfad ein

Config.FileCacheDirectory für die Arbeitsmappen-Cache-Datei. Config.PictureCacheDirectory für den Bilddatei-Cache in der Arbeitsmappe.

Einzelheiten zur Lagerung finden Sie hierFührung

1. Implementieren Sie GridCacheForStream

Hier ein Beispiel für die lokale Dateispeicherung:

Für die serverseitige Speicherung stellen wir auch ein Beispiel bereit. Überprüfen Sie bitte:https://github.com/aspose-cells/Aspose.Cells-for-.NET/blob/master/Examples_GridJs/Models/AwsCache.cs

2. Holen Sie sich JSON aus der Tabellenkalkulationsdatei.

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. Holen Sie sich die Bilder/Formen aus der Tabellenkalkulationsdatei

//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. Tabellendatei im Cache aktualisieren

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

5. Tabellendatei im Cache speichern

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);

Für detaillierte Informationen können Sie sich das Beispiel hier ansehen: https://github.com/aspose-cells/Aspose.Cells-for-.NET/tree/master/Examples_GridJs