Node.js ile C++ üzerinden Excel 2016 Grafiklerini Oku ve Manipüle Et
Olası Kullanım Senaryoları
Aspose.Cells artık Microsoft Excel 2016 grafiklerini okuma ve değiştirme desteği sunmaktadır, bu özellik Microsoft Excel 2013 veya daha önceki sürümlerde bulunmamaktadır.
Excel 2016 Grafiklerini Okuma ve Değiştirme
Aşağıdaki örnek kod, ilk çalışma sayfasında Excel 2016 grafiklerini içeren kaynak Excel dosyasını yükler. Tüm grafikleri tek tek okur ve tipi doğrultusunda başlıklarını değiştirir. Aşağıdaki ekran görüntüsü, kod çalıştırılmadan önceki kaynak Excel dosyasını gösterir. Gördüğünüz gibi, tüm grafikler için başlık aynıdır.
Aşağıdaki ekran görüntüsü, kodun çalıştırılması sonrası çıktı excel dosyasını göstermektedir. Görebileceğiniz gibi, grafik başlığı türüne göre değişmiştir.
Örnek Kod
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, "excel2016Charts.xlsx");
// Load source excel file containing excel 2016 charts
const workbook = new AsposeCells.Workbook(filePath);
// Access the first worksheet which contains the charts
const sheet = workbook.getWorksheets().get(0);
// Access all charts one by one and read their types
for (let i = 0; i < sheet.getCharts().getCount(); i++) {
// Access the chart
const ch = sheet.getCharts().get(i);
// Print chart type
console.log(ch.getType());
// Change the title of the charts as per their types
ch.getTitle().setText("Chart Type is " + ch.getType().toString());
}
// Save the workbook
workbook.save(path.join(dataDir, "out_excel2016Charts.xlsx"));
Konsol Çıktısı
Yukarıdaki örnek kodun kaynak excel dosyası ile çalıştırılması sonucu konsol çıktısı
Waterfall
Treemap
Sunburst
Histogram
BoxWhisker