Node.js ile C++ kullanarak Grafik Sayfasını Erişme

Contents
[ ]

Aşağıdaki örnek, Chart.getWorksheet() özelliğinin nasıl kullanılacağını gösterir. Kod önce çalışma sayfasının adını yazdırır, ardından sayfa üzerindeki ilk grafiğe erişir. Sonra tekrar çalışma sayfası adını, Chart.getWorksheet() özelliği kullanarak yazar.

const path = require("path");
const AsposeCells = require("aspose.cells.node");

// The path to the documents directory.
const dataDir = path.join(__dirname, "data");

// Loads the workbook which contains hidden external links
const workbook = new AsposeCells.Workbook(path.join(dataDir, "sample.xlsx"));

// Access first worksheet of the workbook
const worksheet = workbook.getWorksheets().get(0);

// Print worksheet name
console.log("Sheet Name: " + worksheet.getName());

// Access the first chart inside this worksheet
const charts = worksheet.getCharts();
if (charts.getCount() > 0) {
const chart = charts.get(0);

// Access the chart's sheet and display its name again
console.log("Chart's Sheet Name: " + chart.getWorksheet().getName());
} else {
console.log("No charts available in the worksheet.");
}

Örnek kodun sonucunda ortaya çıkan konsol çıktısı aşağıda verilmiştir. Görebileceğiniz gibi, aynı çalışsayı adını her iki seferde de yazdırır.

Sheet Name: Portfolio

Chart's Sheet Name: Portfolio