Sheet.GetArray() returns Null values

Posted by: Arasudayan.Anand on 30 January 2019, 7:59 am EST

    • Post Options:
    • Link

    Posted 30 January 2019, 7:59 am EST

    Hi,

    I am using Excel VSTO C#.

    I am trying to pull an array of Excel Range, following is the code that I have tried but I get all values as Null in the array:

    GrapeCity.Windows.SpreadSheet.Data.Worksheet wk = new GrapeCity.Windows.SpreadSheet.Data.Worksheet(xlworkSheet.Name);
    object[,] nData = wk.GetArray(0, 0, sheetRange.Rows.Count, sheetRange.Columns.Count);
    

    so nData array is populating with exact number of row and columns that i have passed but the values are null.

    Please advise

  • Posted 31 January 2019, 10:28 am EST

    Hello,

    Looking at the code it seems you are working with WPF version of Spread.

    If yes, you can get the values in range of cells using GetArray() method as follows:

    object[,] arr;

    gcSpreadSheet1.ActiveSheet.SetArray(1, 0, new String[,] { { “One”, “Two” } });

    gcSpreadSheet1.ActiveSheet.SetArray(2, 1, new String[,] { { “Three”, “Four” } }, false);

    //arr contains the values in given range of cells

    arr = gcSpreadSheet1.ActiveSheet.GetArray(1, 0, 3, 2, false);

    Refer to the documentation :

    https://help.grapecity.com/spread/SpreadWPF/webframe.html#GrapeCity.WPF.SpreadSheet.Data~GrapeCity.Windows.SpreadSheet.Data.Worksheet~GetArray(Int32,Int32,Int32,Int32,Boolean).html

    Thanks,

    Deepak Sharma

Need extra support?

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

Learn More

Forum Channels