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

Free Support Forum - aspose.com

How to set number format to Subtotal?

Dear All,


How to set number format to Subtotal?

CellArea ca = new CellArea();
ca.StartRow = 0;
ca.StartColumn = 0;
ca.EndRow = row-1;
ca.EndColumn = 4;
cells.Subtotal(ca, 0, ConsolidationFunction.Sum, new int[] { 2,3,4});

cells… does not have setStyle property??

please help

Hi … please ignore this … it resolved :slight_smile:

Hi,


Good to know that you have figured it out. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.

Hi,


Yeah, thank you… but how to set font bold to Subtotal row? … codes below not working :frowning:
need your help

Style subtotal = new Style();
StyleFlag sf = new StyleFlag();
subtotal.Font.IsBold = false;

CellArea ca = new CellArea();
ca.StartRow = 1;
ca.StartColumn = 0;
ca.EndRow = row-2;
ca.EndColumn = 4;
cells.Subtotal(ca, 0, ConsolidationFunction.Sum, new int[] { 2,3,4 });
cells.ApplyStyle(subtotal, sf);

Hi,


You got to find the subtotal row or range of cells involved, create the style and set the required attributes with relevant style flag options on, finally apply the style to the range of cells or the row accordingly. See the sample code below for your reference:
e.g
Sample code:

Aspose.Cells.Cells cells = workbook.Worksheets[0].Cells;
//Create the range of cells.
Aspose.Cells.Range range = worksheet.Cells.CreateRange(“A5”, “D5”);
range.Name = “Range1”;
Aspose.Cells.Style style = workbook.Styles[workbook.Styles.Add()];
style.Font.IsBold = true;
StyleFlag styleFlag = new StyleFlag();
styleFlag.FontBold = true;
range.ApplyStyle(style, styleFlag);

If you still have any issue or confusion, give us your template file and sample runnable code here, we will check your issue and help you through.

Thank you.