Hi Team,
Hi,
Yes, we want to update cell formulas using smart markers. Can you please help on this ?
Hi,
We have recently supported “formula” tag/parameter in Smart Markers. Please try our latest version Aspose.Cells for .NET v17.4.6:
Aspose.Cells for .NET v17.4.6 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.4.6 (.NET 4.0) compiled in .NET Framework 4.0.
See the following sample with the attached template file (containing smart markers) for your reference:
e.g
Sample code:
DataTable dataTable = new DataTable("Table1");
dataTable.Columns.Add(new DataColumn("Quantity", typeof(int)));
dataTable.Columns.Add(new DataColumn("UnitPrice", typeof(int)));
dataTable.Columns.Add(new DataColumn("Amount", typeof(string)));
int[] q1 = { 2, 3, 4, 1, 5 };
int[] up1 = { 100, 200, 300, 400, 500 };
string[] a1 = { "=A2*B2", "=A3*B3", "=A4*B4", "=A5*B5", "=A6*B6" };
DataRow dataRow;
DateTime currentDate = DateTime.Now;
for (int i = 0; i < 5; i++)
{
dataRow = dataTable.NewRow();
dataRow["Quantity"] = q1[i];
dataRow["UnitPrice"] = up1[i];
dataRow["Amount"] = a1[i];
dataTable.Rows.Add(dataRow);
}
Workbook workbook = new Workbook("e:\\test2\\sm_formulas1.xlsx");
WorkbookDesigner designer = new WorkbookDesigner();
designer.Workbook = workbook;
designer.SetDataSource(dataTable);
designer.Process(true);
OoxmlSaveOptions so = new OoxmlSaveOptions();
workbook.Save(“e:\test2\out1.xlsx”);
Hope, this helps a bit.
Thank you.
Hi Aspose Team,
Hi,
Hi Amjad,
Hi,
Thanks for the sample project and template file.
Well, as we told you earlier we just recently supported “formula” tag/parameter in Smart Markers feature. So, please try our latest fix: Aspose.Cells for .NET v17.4.6 instead of Aspose.Cells for .NET v17.4.0:
Aspose.Cells for .NET v17.4.6 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.4.6 (.NET 4.0) compiled in .NET Framework 4.0.
(Note: please choose any of the above mentioned fixes for your underlying .NET framework version)
I have tested using v17.4.6 and it works fine. Moreover, you got to change the line of code in your project:
i.e.,
var a = new { Code = “A1”, Peer = “A Peer”, CurrentFirmValue = 27966.74M, CurrentEBITDA = 3886M, CurrentEPS =
1.417M, StockPrice = 21.13M, EstimatedEBITDA = 4125.82767M, EstimatedEPS = 1.64407M };
to:
var a = new { Code = “A1”, Peer = ““A Peer””,
CurrentFirmValue = 27966.74M, CurrentEBITDA = 3886M, CurrentEPS = 1.417M,
StockPrice = 21.13M, EstimatedEBITDA = 4125.82767M, EstimatedEPS = 1.64407M };
Hope, this helps a bit.
Thank you.
Hi,
Hi,
Ok. Understood that. We can surround formula with quotes also. Is this right ?
Hi,