We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Workbook

I am trying to create a workbook like in Excel. I have created a MDI Container form and it did not display the grid when I add new WorkbookForm child window. I have copied these codes from the gridpad sample project. WorkbookModel workbook = new WorkbookModel("Workbook"); GridModel sheet1 = new GridModel(); sheet1.RowCount = 100; sheet1.ColCount = 10; GridModel sheet2 = new GridModel(); sheet2.RowCount = 100; sheet2.ColCount = 10; workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 1", sheet1)); workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 2", sheet2)); WorkbookForm doc = new WorkbookForm(workbook); doc.ThemesEnabled = true; doc.MdiParent = this; doc.Show();

1 Reply

AD Administrator Syncfusion Team January 16, 2003 06:58 AM

Try code like this. It is the Initialize call that makes things go through. Attached are both C# and VB sample projects showing a minimal MDI application with grid workbooks. workbook = new WorkbookModel("Workbook"); GridControl grid1 = new GridControl(); grid1.Initialize(); //set properties of grid1 grid1.RowCount = 20; grid1.ColCount = 5; grid1.TableStyle.BackColor = Color.LightBlue; grid1[1,1].Text = "Grid1"; GridControl grid2 = new GridControl(); grid2.Initialize(); //set properties of grid1 grid2.RowCount = 10; grid2.ColCount = 15; grid2.TableStyle.BackColor = Color.LightGray; grid2[1,1].Text = "Grid2"; workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 1", grid1.Model)); workbook.Worksheets.Add(new WorksheetModel(workbook, "Sheet 2", grid2.Model)); WorkbookForm doc = new WorkbookForm(workbook); doc.ThemesEnabled = true; doc.Text = workbook.Name + windowCount.ToString(); doc.MdiParent = this; doc.Show();

Loader.
Live Chat Icon For mobile
Up arrow icon