Read Chart Subtitle from ODS File using Node.js via C++
Contents
[
Hide
]
Read Chart Subtitle from ODS File
Aspose.Cells provides you with the ability to read chart subtitles in ODS files by using the Chart.getSubTitle() property. The following sample code loads the sample ODS file and reads the chart subtitle using the Chart.getSubTitle() property and prints it in the Console Window. Please see the console output of the code given below for reference.
Sample Code
const path = require("path");
const AsposeCells = require("aspose.cells.node");
// Source directory
const sourceDir = path.join(__dirname, "data");
// Load excel file containing charts
const filePath = path.join(sourceDir, "SampleChart.ods");
const workbook = new AsposeCells.Workbook(filePath);
// Access first worksheet
const worksheet = workbook.getWorksheets().get(0);
// Access first chart inside the worksheet
const chart = worksheet.getCharts().get(0);
console.log("Chart Subtitle: " + chart.getSubTitle().getText());
Console Output
Chart Subtitle: Sample Chart Subtitle