Home > database >  Jump to a certain cell in Syncfusion Spreadsheet Control
Jump to a certain cell in Syncfusion Spreadsheet Control

Time:08-26

I'm using Winforms C# and I would like to add the Syncfusion Spreadsheet Control. I would like to ask, it is possible to jump to a certain cell in the control form from another form?

Thanks

CodePudding user response:

You can achieve your requirement by using forms loaded events and Spreadsheet.WorkbookLoaded events are shown below,

Form1.CS

button1.Click  = Button1_Click;

private void Button1_Click(object sender, EventArgs e)

{

    Form2 frm = new Form2();

    frm.Show();

    this.Hide();

}

Form2.CS

this.Load  = Form2_Load;

private void Form2_Load(object sender, EventArgs e)

{

    try

    {

        var fileStream = new FileStream(@"..\..\Data\Filtering.xlsx", FileMode.Open);

        spreadsheet.Open(fileStream);          

    }

    catch

    {

 

    }

    spreadsheet.WorkbookLoaded  = Spreadsheet_WorkbookLoaded;

}

 

private void Spreadsheet_WorkbookLoaded(object sender, Syncfusion.Windows.Forms.Spreadsheet.Helpers.WorkbookLoadedEventArgs args)

{

    //Moves current cell to the mentioned row and column index of the cell,

    spreadsheet.ActiveGrid.CurrentCell.MoveCurrentCell(5, 5);

 

    //For moving the current cell to a different sheet,

    spreadsheet.SetActiveSheet("Sheet1");

    spreadsheet.ActiveGrid.CurrentCell.MoveCurrentCell(6, 5);

}
  • Related