在工作表内设置表格或列表对象的备注
Contents
[
Hide
]
您可以使用ListObject.Comment属性设置工作表中表格或列表对象的注释。该注释将在xl/tables/tableName.xml文件中可见。
设置工作表内表格或列表对象的批注
以下示例代码加载源Excel文件,设置工作表中第一个表格或列表对象的注释。
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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Open the template file. | |
Workbook workbook = new Workbook(dataDir + "source.xlsx"); | |
// Access first worksheet. | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Access first list object or table. | |
ListObject lstObj = worksheet.ListObjects[0]; | |
// Set the comment of the list object | |
lstObj.Comment = "This is Aspose.Cells comment."; | |
// Save the workbook in xlsx format | |
workbook.Save(dataDir + "SetCommentOfTableOrListObject_out.xlsx", SaveFormat.Xlsx); |