从ODS文件中读取图表副标题
Contents
[
Hide
]
从ODS文件中读取图表副标题
Aspose.Cells通过使用Chart.SubTitle属性为您提供了读取ODS文件中图表副标题的能力。以下示例代码加载sample ODS文件,并使用Chart.SubTitle属性读取图表副标题并将其打印在控制台窗口中。请参考下面给出的代码的控制台输出。
示例代码
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(GetChartSubTitleForODSFile.class) + "Charts/"; | |
String filePath = dataDir + "SampleChart.ods"; | |
Workbook workbook = new Workbook(filePath); | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Load the chart from source worksheet | |
Chart chart = worksheet.getCharts().get(0); | |
System.out.println("Chart Subtitle: " + chart.getSubTitle().getText()); |
控制台输出
Chart Subtitle: Sample Chart Subtitle