Formula in ColumnHeader

  • sameek 10 years, 1 month ago

    Are you able to put a formula in a columnheader.  I am not able to get this to work?

    Thanks

  • 1p
    scotts FP1p 10 years, 1 month ago

    Hello,

    This is not supported.

  • bill FP 9 years, 10 months ago

    While we don’t support formulas in column header cells, you could put the formulas in the first row and make it a frozen (fixed) row and then hide the column header row, making the first row appear as if it is the header.

  • valm 4 months ago

    Has this changed? It’s been 9yrs, hopefully you provide something now :)

  • 15p
    Kevin Ashley15p 4 months ago

    Hello,

    I’m pretty sure that should work, but I’m trying it out in code and its not correctly setting the formula in the column header. I have submitted this to the developers to look into, and I will get back to you.

    Regards,
    Kevin

  • valm 4 months ago

    Thanks Kevin! We’ll be looking forward to your reply.

  • valm 4 months ago

    I noticed this is a .NET forum…we are developing in javascript and using:

    sheet.setFormula(2, i, formula, GC.Spread.Sheets.SheetArea.colHeader

  • 15p
    Kevin Ashley15p 4 months ago

    Hello,

    The way that Spread WinForms V10 is currently implemented, we only support the formula working internally in column headers, and not being able to refer to the sheet data area. However, you can make it work using some hidden API. Keep in mind that this will not be supported after V11. In the meantime, you can using something like the following code:

    FarPoint.Win.Spread.ColumnHeader ch;
    ch = fpSpread1.ActiveSheet.ColumnHeader;
    ch.RowCount = 2;
    fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 0].Value = 2;
    fpSpread1.ActiveSheet.ColumnHeader.Cells[0, 1].Value = 3;
    ((DefaultSheetDataModel)fpSpread1.ActiveSheet.Models.ColumnHeaderData).SetFormula(1, 0, "SUM(A1:B1)");// Notice: A1:B1 belongs to the column header
     
    // This API is marked as internal, it is not meant for public use
    ((DefaultSheetDataModel)fpSpread1.ActiveSheet.Models.Data).ShareCalculations(fpSpread1.ActiveSheet.Models.ColumnHeaderData as DefaultSheetDataModel);
    ((DefaultSheetDataModel)fpSpread1.ActiveSheet.Models.ColumnHeaderData).SetFormula(1, 1, "SUM(Sheet1!A1:A5)");
    
    fpSpread1.ActiveSheet.Cells[0, 0].Value = 1;
    fpSpread1.ActiveSheet.Cells[1, 0].Value = 3;

    The developers are going to work on integrating that behavior into ColumnFooters. If it is successful, they can look into using it for other areas like ColumnHeaders and RowHeaders.

    In reference to your JS question, looks like you already have a response in that respective forum:

    http://sphelp.grapecity.com/forums/topic/having-formulas-setformula-applied-to-a-cell-in-the-header/

    Regards,
    Kevin

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to create new topics.