Is there any feature like summary row in Spread.Net ?

Posted by: vjoy on 8 September 2017, 2:50 pm EST

  • Posted 8 September 2017, 2:50 pm EST

    Is there any feature like summary row in Spread.Net ? Like, I have a grid which contains some financial data. Can I have one more grid just below the other grid, which will

    consider the data from parent grid and make calculations based on the operators present in parent grid ? 

  • Replied 8 September 2017, 2:50 pm EST

    Hello,

     
    You can show a column footer or a group footer or both for the sheet and put information in the footer such as formulas or text. The column footer is an area at the bottom of the sheet. The group footer is an extra row of footer cells at the bottom of a sheet with grouping, if you are using the grouping feature. 

     In order to calculate the column footer or group footer result with a formula, set the SetAggregationType method of the ColumnFooter object to the correct formula type for that column. The following figure displays a column footer with a formula in the column. For example using the following code you can show a ColumnFooter for all rows:

     
    fpSpread1.Sheets[0].RowCount = 10;

    fpSpread1.Sheets[0].ColumnCount = 6;

     
    // Show the column footer. 

    fpSpread1.Sheets[0].ColumnFooter.Visible = true; 

    fpSpread1.Sheets[0].ColumnFooter.RowCount = 2; 

    fpSpread1.Sheets[0].ColumnFooter.DefaultStyle.ForeColor = Color.Purple;  

    fpSpread1.Sheets[0].ColumnFooter.Columns[5].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Left;  

    fpSpread1.Sheets[0].ColumnFooter.Cells[0, 12].RowSpan = 2; 

    fpSpread1.Sheets[0].ColumnFooter.Cells[0, 0].Value = "test";

     

    Thanks,

  • Replied 8 September 2017, 2:50 pm EST

    Hello,

    Summary rows basically refer to a row in the same grid that holds the results for the various aggregation formulas applied to different columns in the grid. Spread also has the feature of setting various formulas in the column footer that provides different aggregation of the values in the column like sum or average of all the values in a column.

    When we set the formulas in a Column Footer, then these formulas are
    simply meant to provide an aggregation for all the values in the Column.
    The aggregation can be of different types like sum of all the values in
    a column, average of all the values in a Column, maximum and minimum
    value in a column and more. The SetAggregationType method is used to set
    the formulas in a column footer. It has three parameters. First and the
    second one specify the row index and column index in the Column Footer
    to which the formula is to be applied. Since a column footer can have
    multiple rows so you need to specify the row index and column index
    specifies to which column are we actually applying the formula. The last
    parameter is an enum value where the enum contains all the different
    aggregation formulas that can be applied in a column footer. So, the row
    index and column index specify the cell in the Column Footer to which
    the formula is applied and the enum value tells which formula is
    applied.

    I am attaching a sample which depicts how you can use
    SetAggregationType method to calculate the sum of a column, average of a
    column and maximum value in a column, kindly have a look at the same.
    Hope it will help you. Please let me know if you have any queries
    further.

    Thanks,

    Manpreet Kaur

     


    2011/12/ColumFooterFormula.zip
  • Replied 8 September 2017, 2:50 pm EST

    Hey that's great. Thank you so much. My requirement is upto one formula only.

    Just as a curiosity, is it possible to apply the formula based on multiple operators ? Like row1 + row2 - (row3 * row4) = result. something of this sort.

  • Replied 8 September 2017, 2:50 pm EST

    Hello,

    Yes, you can surely apply a formula with multiple operators to a cell in Spread.

    Hope it will help you. Please let me know if you have any queries further.

    Thanks,

    Manpreet Kaur.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels