使用智能标记合并数据时获取通知
Contents
[
Hide
]
Aspose.Cells API 提供工作簿设计器类使用智能标记格式和公式放置在设计师电子表格然后处理工作簿设计器类根据指定的智能标记填充数据。有时,可能需要获取有关单元格引用或正在处理的特定智能标记的通知。这可以通过使用工作簿设计器.CallBack财产和ISmartMarkerCallBack接口随着 Aspose.Cells for .NET 8.6.2 的发布而暴露。
下面的一段代码演示了ISmartMarkerCallBack定义处理回调的新类的接口WorkbookDesigner.进程方法。
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 | |
class SmartMarkerCallBack: ISmartMarkerCallBack | |
{ | |
Workbook workbook; | |
public SmartMarkerCallBack(Workbook workbook) { | |
this.workbook = workbook; | |
} | |
public void Process(int sheetIndex, int rowIndex, int colIndex, String tableName, String columnName) { | |
Console.WriteLine("Processing Cell: " + workbook.Worksheets[sheetIndex].Name + "!" + CellsHelper.CellIndexToName(rowIndex, colIndex)); | |
Console.WriteLine("Processing Marker: " + tableName + "." + columnName); | |
} | |
} |
其余过程包括加载包含智能标记的设计器电子表格工作簿设计器并通过设置数据源进行处理。为了使示例保持简单,我们使用了一个仅包含两个智能标记的预定义设计器电子表格,如下面的快照所示,其中动态创建数据源以根据指定的智能标记合并数据。
![]() |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|