Free Support Forum -

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.

so please give me some work around using aspose.words


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.

<span style=“font-size:10.0pt;
font-family:“Courier New”;color:#2B91AF;mso-font-kerning:0pt;mso-ansi-language:
PL;mso-no-proof:yes”>Document<span style=“font-size:10.0pt;font-family:
“Courier New”;mso-font-kerning:0pt;mso-ansi-language:PL;mso-no-proof:yes”> 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.MoveToCell(0, table.Rows.Count - 1, 1, 0);



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?


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.