We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merging multiple fields

How can I merge following two properties in one column?
Person.Firstname & Person.LastName

Can I do something like to achieve merged values in one column,

&=[Person].FirstName + &=[Person].LastName

GIve some working example.

@kuns200,
You may please try using following sample code where Formula parameter is used in the Smart Marker field and share the feedback. For more example please visit here.

//Create a datatable and add column named TestFormula
DataTable dt = new DataTable();
dt.Columns.Add("FirstName");
dt.Columns.Add("LastName");
dt.Columns.Add("TestFormula");

//Create first row with formula (which basically concatenates three strings)
DataRow dr = dt.NewRow();
dr["FirstName"] = "Ahsan";
dr["LastName"] = "Iqbal";
dr["TestFormula"] = $"=\"{dr["FirstName"]} \" & \"{dr["LastName"]} \"";
dt.Rows.Add(dr);

//Create second row like above
dr = dt.NewRow();
dr["FirstName"] = "Munawwar";
dr["LastName"] = "Khan";
dr["TestFormula"] = $"=\"{dr["FirstName"]} \" & \"{dr["LastName"]} \"";
dt.Rows.Add(dr);

//Create third row like above
dr = dt.NewRow();
dr["FirstName"] = "Babar";
dr["LastName"] = "Malik";
dr["TestFormula"] = $"=\"{dr["FirstName"]} \" & \"{dr["LastName"]} \"";
dt.Rows.Add(dr);

//Set the name of the data table
dt.TableName = "MyDataSource";

//Create a workbook
Workbook wb = new Workbook();

//Access first worksheet
Worksheet ws = wb.Worksheets[0];

//Put the smart marker field with formula parameter in cell A1
ws.Cells["A1"].PutValue("&=MyDataSource.TestFormula(Formula)");

//Create workbook designer, set data source and process it
WorkbookDesigner wd = new WorkbookDesigner(wb);
wd.SetDataSource(dt);
wd.Process();

//Save the workbook in xlsx format
wb.Save(outputDir + "outputUsingFormulaParameterInSmartMarkerField.xlsx");

Console.WriteLine("UsingFormulaParameterInSmartMarkerField executed successfully.\r\n");