FarPoint.Win.Spread.Model.ParseException: Invalid token was encountered.

Posted by: thunaivan on 8 September 2017, 12:50 pm EST

  • Posted 8 September 2017, 12:50 pm EST


    I am getting the following error when using  the formula sum function 

    FarPoint.Win.Spread.Model.ParseException: Invalid token was
    Error offset: 4

       at a9.a(String A_0, Int32
    A_1, Int32 A_2, Boolean A_3, Hashtable A_4, Hashtable A_5, ArrayList

    FarPoint.Win.Spread.Model.DefaultSheetDataModel.SetFormula(Int32 row, Int32
    column, String value)

    FarPoint.Win.Spread.Cell.set_Formula(String value)

    NTrust.frmFollowupBranchCustomized.ViewData() in

    NTrust.frmFollowupBranchCustomized.spectrumToolbar1_Click(Object sender,
    ToolBarButtonClickEventArgs e) in

    we are using FarPoint spread version 2.5

    thanks in advance.


  • Replied 8 September 2017, 12:50 pm EST


    There are two reference styles you can use for formulas (A1 and R1C1 format). It sounds like you are using one of these, but have the ReferenceStyle property set to the other.

  • Replied 8 September 2017, 12:50 pm EST


    Here,the referencestyle used A1, this is the code i have used : grdBranchDetails_Sheet1.ReferenceStyle = FarPoint.Win.Spread.Model.ReferenceStyle.A1;

    Then why the error parse exception has occur.

    it occur when i load the datas in the grid second time after clearing the grid. First time, the error won't occur.
  • Replied 8 September 2017, 12:50 pm EST


    What is the formula you are using that throws this exception? How are you clearing and loading the spreadsheet? Are you setting the ReferenceStyle everytime you are loading the spreadsheet, or just the first initialization?

  • Replied 8 September 2017, 12:50 pm EST


    A ParseException is thrown when the Formula property (or SetFormula method) is passed a string that is not a valid text representation of a formula.  The error offset indicates the position (zero based) in the string that is causing the problem.  There are multiple reasons a ParseException could be thrown.  Without knowing the string you are assigning, it is difficult for me to guess the problem with in the string.  One possibility is that your string includes a cross sheet reference to a non-existent sheet (e.g. string is "SUM(Sheet3!A1:C3" but "Sheet3" does not exist).  When you cleared the grid, did you remove a sheet (or change the name of a sheet) that you later attempted to reference in a formula?

Need extra support?

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

Learn More

Forum Channels