I'm trying to insert rows from the SQL database in the predefined Excel Template. The template is attached herewith. The template has four columns including the “Price” column. How do i calculate total of “Price” column? Requirement is that the total should be placed at the end of all the rows under the “Price” column. Here are the issues I encountered when I tried the following three options:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
1> I can put the SUM formula in D3 which is the template’s “Total” cell and then call the WorkBook.CalculateFormulas() method. But I would not know the range in advance. The number rows may not be always the same.
2> There is CelI.PutValue() function. I can calculate the total of “Price” column somehow in the C# code. But I would not know in which cell “Total” will go because the number rows returned from the database vary. So the “Total” cell’s location keeps changing. Any alternate solution if I already have the total calculated?
3> Let Aspose calculate the total using Cells.SubTotal() function. This funtion also takes CellArea, but again in this case also i need to know the CellArea in advance.
I think there should be some in built solution which i don't know becuase this very common senario in excel.