الحصول على إخطارات أثناء دمج البيانات مع العلامات الذكية

Contents
[ ]

يوضح الجزء التالي من التعليمات البرمجية استخدامISmartMarkerCallBack واجهة لتعريف فئة جديدة تتعامل مع معاودة الاتصالالمصنف المصمم. العمليةطريقة.

// 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);
}
}

تتضمن بقية العملية تحميل جدول بيانات المصمم الذي يحتوي على العلامات الذكية معالمصمم المصممومعالجتها عن طريق تحديد مصدر البيانات. من أجل الحفاظ على المثال بسيطًا ، استخدمنا جدول بيانات مصممًا محددًا مسبقًا يحتوي على اثنين فقط من العلامات الذكية كما هو موضح في اللقطة أدناه حيث يتم إنشاء مصدر البيانات ديناميكيًا لدمج البيانات وفقًا للعلامات الذكية المحددة.

ما يجب القيام به: image_بديل_نص
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
string outputPath = dataDir + "Output.out.xlsx";
// Creating a DataTable that will serve as data source for designer spreadsheet
DataTable table = new DataTable("OppLineItems");
table.Columns.Add("PRODUCT_FAMILY");
table.Columns.Add("OPPORTUNITY_LINEITEM_PRODUCTNAME");
table.Rows.Add(new object[] { "MMM", "P1" });
table.Rows.Add(new object[] { "MMM", "P2" });
table.Rows.Add(new object[] { "DDD", "P1" });
table.Rows.Add(new object[] { "DDD", "P2" });
table.Rows.Add(new object[] { "AAA", "P1" });
// Loading the designer spreadsheet in an instance of Workbook
Workbook workbook = new Workbook(dataDir + "source.xlsx");
// Loading the instance of Workbook in an instance of WorkbookDesigner
WorkbookDesigner designer = new WorkbookDesigner(workbook);
// Set the WorkbookDesigner.CallBack property to an instance of newly created class
designer.CallBack = new SmartMarkerCallBack(workbook);
// Set the data source
designer.SetDataSource(table);
// Process the Smart Markers in the designer spreadsheet
designer.Process(false);
// Save the result
workbook.Save(outputPath);