从 ODS 文件中读取图表副标题
Contents
[
Hide
]
从 ODS 文件中读取图表副标题
Aspose.Cells 为您提供阅读 ODS 文件中图表字幕的能力图表.副标题财产。下面的示例代码加载样本 ODS 文件并使用阅读图表副标题图表.副标题属性并将其打印在控制台窗口中。请参阅下面给出的代码的控制台输出以供参考。
示例代码
This file contains hidden or 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