Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Collapse]Spreadsheet
   [Expand]Product Information
    Product Structure
    Getting Started
   [Collapse]Spreadsheet Document
     Workbook
     Worksheets
     Cells and Cell Ranges
     Rows and Columns
     Shapes, Pictures, Charts
     Comments
     Measure Units
    Supported Formats
   [Expand]Cell Basics
   [Expand]Spreadsheet Formulas
    Defined Names
    Data Binding
    Data Validation
   [Expand]Data Presentation
    Data Grouping
   [Expand]Pivot Table Overview
   [Expand]Charting Overview
    Printing
    Events
   [Expand]Mail Merge Overview
    Protection
    Find and Replace
   [Expand]Visual Elements
    Services
   [Expand]Shortcuts
   [Expand]Examples
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Workbook

A workbook is a document in the SpreadsheetControl. It is an object that exposes the IWorkbook interface. The IWorkbook interface provides a comprehensive set of properties and methods required to manipulate the corresponding workbook. To access a workbook that is currently loaded in SpreadsheetControl, use the SpreadsheetControl.Document property. This is the starting point for using the XtraSpreadsheet API (see the Examples example).

A workbook consists of one or more worksheets stored within the WorksheetCollection collection. To access this collection, use the IWorkbook.Worksheets property. Each worksheet has a unique name and position within the workbook. Thus, you can access an individual worksheet by its name or index via the WorksheetCollection.Item property.

Use other WorksheetCollection object properties to manage the workbook's set of worksheets (add a new worksheet, remove an existing worksheet, assign an active worksheet, etc.).

A workbook may also contain specific sheets that display only a chart and do not have other data. These sheets are called chart sheets and are stored in the ChartSheetCollection collection returned by the IWorkbook.ChartSheets property. The ChartSheetCollection.Item property enables you to get an individual chart sheet by its name or index in the collection.

The IWorkbook.Sheets collection stores all sheets (worksheets and chart sheets) contained in a workbook. Use this collection when you need to access a sheet of any type.

By default, when you create a SpreadsheetControl instance, it contains a workbook with one empty worksheet ("Sheet1"). The same workbook is also created when you call the SpreadsheetControl.CreateNewDocument or IWorkbook.CreateNewDocument method. To load an existing document into a SpreadsheetControl, use the SpreadsheetControl.LoadDocument or IWorkbook.LoadDocument method. To save a workbook after all modifications are complete, use the SpreadsheetControl.SaveDocument or IWorkbook.SaveDocument method. The Supported Formats topic lists the file formats supported for loading and saving workbooks.

You can print a workbook via the SpreadsheetControl.Print, SpreadsheetControl.ShowPrintDialog and SpreadsheetControl.ShowPrintPreview methods. Use the Worksheet.PrintOptions property to set print options for each individual worksheet.

A workbook contains a collection of styles, which can be used to format cell appearance in any worksheet. To access and modify this collection (for example, add new styles or modify existing styles), use the IWorkbook.Styles property.

The IWorkbook.DefinedNames collection includes cell, formula and constant defined names that can be used in any worksheet within the workbook without qualification. See the Defined Names topic for more information.

The IWorkbook.DocumentSettings property provides access to an object whose members you can use to customize different workbook settings. For example, you can specify whether the R1C1 reference style should be used in a workbook (DocumentSettings.R1C1ReferenceStyle), or set different workbook calculation options (DocumentSettings.Calculation).

You can also specify other workbook options using the corresponding properties of an object returned by SpreadsheetControl.Options or IWorkbook.Options.

Expanded See Also

How would you rate this topic?​​​​​​​