Akıllı İşaretleyiciler ile Verileri Birleştirirken Bildirim Alma

Contents
[ ]

Aşağıdaki kod parçası, kullanımını gösterir.ISmartMarkerCallBack için geri aramayı işleyen yeni bir sınıf tanımlamak için arayüzWorkbookDesigner.Processyöntem.

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

Sürecin geri kalanı, Akıllı İşaretleyicileri içeren tasarımcı elektronik tablosunun yüklenmesini içerir.Çalışma KitabıTasarımcısıve veri kaynağını ayarlayarak işleyin. Örneği basit tutmak için, aşağıdaki anlık görüntüde gösterildiği gibi yalnızca iki Akıllı İşaretleyici içeren önceden tanımlanmış bir tasarımcı elektronik tablosu kullandık; burada veri kaynağı, verileri belirtilen Akıllı İşaretleyicilere göre birleştirmek için dinamik olarak oluşturuluyor.

yapılacaklar:resim_alternatif_metin
// 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);