禁用图表的数据标签文本换行
Contents
[
Hide
]
Microsoft Excel 2013允许用户在图表的数据标签中换行或取消换行。默认情况下,图表的数据标签中的文字是处于换行状态。
Aspose.Cells提供了一个DataLabels.IsTextWrapped属性,您可以设置为True或False以分别启用或禁用数据标签的文字换行。
下面的代码示例显示了如何禁用图表数据标签的文字换行。
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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Load the sample Excel file inside the workbook object | |
Workbook workbook = new Workbook(dataDir + "sample.xlsx"); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Access the first chart inside the worksheet | |
Chart chart = worksheet.Charts[0]; | |
// Disable the Text Wrapping of Data Labels in all Series | |
chart.NSeries[0].DataLabels.IsTextWrapped = false; | |
chart.NSeries[1].DataLabels.IsTextWrapped = false; | |
chart.NSeries[2].DataLabels.IsTextWrapped = false; | |
// Save the workbook | |
workbook.Save(dataDir + "Output_out.xlsx"); |