Create a Workbook
Before you can take advantage of the features in the Infragistics Excel Engine, you will need to create a Workbook object. You can do this by either reading an existing Microsoft® Excel® file, as explained in the How Do I… topic: Read an Excel File into a Workbook or you can create a blank workbook. When you create a blank workbook, before writing it to a file, you must add at least one worksheet. You can also set various display and print options on the workbook and worksheets.
The following code demonstrates how to create a blank workbook, set a few properties, and add some worksheets.
Dim workbook As New Infragistics.Documents.Excel.Workbook()
workbook.WindowOptions.ScrollBars = Infragistics.Documents.Excel.ScrollBars.Vertical
Dim worksheet1 As Infragistics.Documents.Excel.Worksheet = _
workbook.Worksheets.Add("Sheet1")
Dim worksheet2 As Infragistics.Documents.Excel.Worksheet = _
workbook.Worksheets.Add("Sheet2")
worksheet2.Rows.Item(0).Cells.Item(0).Value = 14.56
worksheet2.DisplayOptions.MagnificationInNormalView = 200
workbook.WindowOptions.SelectedWorksheet = worksheet2
Infragistics.Documents.Excel.Workbook workbook = new Infragistics.Documents.Excel.Workbook();
workbook.WindowOptions.ScrollBars = Infragistics.Documents.Excel.ScrollBars.Vertical;
Infragistics.Documents.Excel.Worksheet worksheet1 = workbook.Worksheets.Add( "Sheet1" );
Infragistics.Documents.Excel.Worksheet worksheet2 = workbook.Worksheets.Add( "Sheet2" );
worksheet2.Rows[0].Cells[0].Value = 14.56;
worksheet2.DisplayOptions.MagnificationInNormalView = 200;
workbook.WindowOptions.SelectedWorksheet = worksheet2;