Node.js aracılığıyla C++ kullanarak Excel den JSON a Dönüştürme
Excel Çalışma Kitabını JSON’a Dönüştür
Excel Workbook’u JSON’a dönüştürmenin nasıl yapılacağını merak etmeyin, çünkü Aspose.Cells for Node.js via C++ kütüphanesi en iyi çözümü sunar. Aspose.Cells API, elektronik tabloları JSON formatına dönüştürmeyi destekler. Workbook’u JSON’a aktarmak için, SaveFormat.Json parametresini Workbook.save(string, SaveFormat) metodunun ikinci parametresi olarak geçirin. Ayrıca, sayfayı JSON’a ihracatını yapılandırmak için JsonSaveOptions sınıfını kullanabilirsiniz.
Aşağıdaki kod örneği, Excel Workbook’u JSON’a dışa aktarmayı gösterir. Kaynak dosyayı (sample.xlsx) JSON dosyasına dönüştürmek için kodu kullanın ve referans için sunulmuştur.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Load your source workbook
const workbook = new AsposeCells.Workbook(filePath);
// Convert the workbook to json file.
workbook.save("sample_out.json");
Aşağıdaki kod örneği, JsonSaveOptions sınıfını kullanarak ek ayarları belirler ve Excel Workbook’u JSON’a dışa aktarmayı gösterir. Kaynak dosya (sample.xlsx)‘yi JSON dosyasına dönüştürmek için kodu inceleyebilirsiniz.
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// The path to the documents directory.
const dataDir = path.join(__dirname, "data");
const filePath = path.join(dataDir, "sample.xlsx");
// Create an options of saving the file.
const options = new AsposeCells.JsonSaveOptions();
// Set the exporting range.
options.setExportArea(AsposeCells.CellArea.createCellArea("B1", "C4"));
// Load your source workbook
const workbook = new AsposeCells.Workbook(filePath);
// Convert the workbook to json file.
workbook.save("sample_out.json", options);