Subtotal and Total

I have been using aspose.cells and using excel grouping i can get the total and subtotals but i am unable to get the same using aspose.words. Even this link is not giving answer to my question because total is stroed i your table itself.
https://docs.aspose.com/words/net/nested-mail-merge-with-regions/
so please give me some work around using aspose.words

Hi,

Thanks for your inquiry. In your case, I suggest you to use SUM(ABOVE) field. Please insert this field in the last row of table as shown in following code snippet.

Document doc = new Document(MyDir + "in.docx");
DocumentBuilder builder = new DocumentBuilder(doc);

Table table = (Table)doc.GetChild(NodeType.Table, 0, true);
builder.MoveToCell(0, table.Rows.Count - 1, 0, 0);
builder.InsertField(@"=SUM(ABOVE)");
builder.MoveToCell(0, table.Rows.Count - 1, 1, 0);
builder.InsertField(@"=SUM(ABOVE)");

doc.UpdateFields();
doc.Save(MyDir + "AsposeOut.docx");

Hope this helps you. Please let us know if you have any more queries.

Thanks for the reply.
half of my query is resolved but i also want to provide subtotals in the middle of document.
Lets say i want the subtotal by employee in middle of document and grand total at the end of the page.
End of the page total i can get from this but how to get subtotals?

Hi,

Thanks for your inquiry. It would be great if you please share some more detail about your scenario along with input and output Word document.