GrapeCity Forums

The GrapeCity Message Boards
Welcome to GrapeCity Forums Sign in | Join | Help
in Search

i have some problem with columns range formula

Last post 06-25-2009, 2:37 PM by scotts. 1 replies.
Sort Posts: Previous Next
  •  06-25-2009, 11:41 AM 79495

    i have some problem with columns range formula

    helo there..

     i have a problem to calculate with formula.

    i have more than 50 columns on my spread, and i want to set formula on , let's say range 15th columns to 20th columns.

    i replaced  column name of my spread with as same as my data set column name.

    when i write this code :

    int ColStart = ColIdx - 5;

    String lbl = ActiveSheet.Columns[ColStart].Label.ToString();

    //ColStart is index of start of the range of colloumn to ColIdx.

    //lbl and lb2, i used this string so that i can get the label of the column, but it doesn't work.

    String lb2 = ActiveSheet.Columns[ColIdx].Label.ToString();

    //CollIdx is index of the column i want to set the formula

    ActiveSheet.Columns[ColIdx].Formula = "SUM("+lbl+"1:"+lb2+"1)";

    i get an error like this : Invalid token was encountered.\nError offset: 4

    after debuging, i thought that it was because of the label name that i get from the column name.

    How can i changet the label into character label, so that i can used that formula? like this may be : "SUM("AA1 : AZ1")"

    or , was there anything else of solving this problem? please help me.

    Let me show u what i want on spread web :

    JANUARY FEBRUARY MARCH TOTAL

    10%          10%            10%      30%

    20 %         20%            20%      60%

     

    the formula is set into total column.

    thx for helping.

  •  06-25-2009, 2:37 PM 79505 in reply to 79495

    Re: i have some problem with columns range formula

    Hello,

    You should be able to use the GetColumnAutoText method to get the letter that would be in this column header if you had not put custom text in the cell.


    Scott S.
    Product Manager, Spread ASP.NET
    GrapeCity FarPoint
View as RSS news feed in XML
     FarPoint Forums Home