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

Free Support Forum - aspose.com

Multiple Level Sub total in excel using Expose cells

How we can do multiple level subtotal using Aspose cells


I tried using following code but it did not worked.
CellArea ca = CellArea.CreateCellArea(“A2”, “M” + row.ToString());
            <span style="color:green;">//Apply subtotal, the consolidation function is Sum and it will applied to</span>
            <span style="color:green;">//Second column (B) in the list</span>
            cells.Subtotal(ca, 1, <span style="color:#2b91af;">ConsolidationFunction</span>.Sum, <span style="color:blue;">new</span> <span style="color:blue;">int</span>[] { 6, 7, 9, 11 });

            ca = CellArea.CreateCellArea(<span style="color:#a31515;">"A2"</span>, worksheet.Cells.LastCell.Name);
            cells.Subtotal(ca, 3, <span style="color:#2b91af;">ConsolidationFunction</span>.Sum, <span style="color:blue;">new</span> <span style="color:blue;">int</span>[] { 6, 7, 9 }, <span style="color:blue;">false</span>, <span style="color:blue;">false</span>, <span style="color:blue;">true</span>);

            <span style="color:green;">//Set the direction of outline summary</span>
            worksheet.Outline.SummaryRowBelow = <span style="color:blue;">true</span>;</pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;">First I have to do op 1 and then op 2 on same excel spreedsheet.</pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;"> </pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre><pre style="font-family: Consolas; font-size: 13px; background: white;"><br></pre></div>

Hi,


Thanks for providing us some details and sample code.

Please create a sample Excel file containing your desired multi-level Subtotals set for the data set in the worksheet, you may create your desired file in Ms Excel manually. Also provide your output Excel file by Aspose.Cells APIs and paste your complete sample code (runnable), we will check your existing code and may tweak a bit (if required).

Thank you.