Working beyond intial rows and columns

Hi,
I'm currently using the sfSpreadsheet in WPF from essentialStudio 17.4.0.39. When the form first shows it seems to be shown with a default of 101 rows and 101 columns. I am trying to load data more than this into the sheet.
In my code I try and add extra rows to the bottom in the following fashion (aiming to increase rows to around 150):
    spreadsheet.ActiveSheet.InsertRow(101, 50);
    spreadsheet.ActiveGrid.Model.InsertRows(101, 50);

I am then trying to define a named range for a column like so:
      IRange start = sheet.Range[1, 1];
      IRange end = sheet.Range[150, 1];
      string address = start.AddressLocal + ":" + end.AddressLocal;
      spreadsheet.AddNamedRange(name, address, sheet.Name);


After doing this, however, the number of rows in the grid remains at the default of 101 as I debug, and the named range is only defined for the range A1:A101. If I scroll the grid down past row 101, I can see any data I may have loaded past row 101 is there, but is there a way to size the number of rows/columns to this without having to scroll? Are there recommended strategies for loading data more than the initial size of the sheet? 

Appreciate any advice or direction.

1 Reply

BR Backia Raj Kanagaraj Syncfusion Team March 19, 2020 01:44 PM UTC

Hi Troy, 
 
Thanks for contacting our syncfusion support. 
 
In my code I try and add extra rows to the bottom in the following fashion (aiming to increase rows to around 150): 
    spreadsheet.ActiveSheet.InsertRow(101, 50); 
    spreadsheet.ActiveGrid.Model.InsertRows(101, 50); 
You can set row count and column count programmatically. 
 
Code snippet: 
spreadsheet.DefaultRowCount = 200; 
spreadsheet.DefaultColumnCount = 150; 
 
 
I am then trying to define a named range for a column like so: 
      IRange start = sheet.Range[1, 1]; 
      IRange end = sheet.Range[150, 1]; 
      string address = start.AddressLocal + ":" + end.AddressLocal; 
      spreadsheet.AddNamedRange(name, address, sheet.Name); 
you can get your defined named range in WorkbookLoaded event. Refer the below code for your reference. 
 
spreadsheet.WorkbookLoaded += Spreadsheet_WorkbookLoaded; 
 
private void Spreadsheet_WorkbookLoaded(object sender, Syncfusion.UI.Xaml.Spreadsheet.Helpers.WorkbookLoadedEventArgs args) 
{ 
   IRange start = spreadsheet.ActiveSheet.Range[1, 1]; 
   IRange end = spreadsheet.ActiveSheet.Range[150, 1]; 
   string address = start.AddressLocal + ":" + end.AddressLocal; 
   spreadsheet.AddNamedRange("name_range_1", address, spreadsheet.ActiveSheet.Name); 
} 
 
 
 
 
We've also prepared a sample of this. Please refer to the sample link below, 
 
 
Regards, 
Backia Raj Kanagaraj 


Loader.
Up arrow icon