Forums     Knowledge Base     OfficeWriter Online     
 
 
This documentation is for
OfficeWriter v3.7.1
.NET Platform

View Docs for Another
Version or Platform

Programmer's Reference > ExcelApplication API > Workbook

The Workbook Object


A Workbook object represents an Excel workbook. To return a Workbook object: Call ExcelApplication.Create() to create a new Excel workbook. Call ExcelApplication.Open() to open an existing Excel workbook.



Examples:

[csharp]
// Create a new Workbook
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create();

// Open an existing Workbook
ExcelApplication xla = new ExcelApplication(); 
Workbook wb = xla.Open(@"C:\Reports\Report.xls");
[vbnet]
' Create a new Workbook
Dim xla As New ExcelApplication()
Dim wb As Workbook = xla.Create()

' Open an existing Workbook
Dim xla As New ExcelApplication()
Dim wb As Workbook = xla.Open("C:\Reports\Report.xls")


Workbook Properties

Property Type Access Description
DisplayTabs boolean read
write

Shows or hides the worksheet tabs at the bottom of the workbook window

DocumentProperties DocumentProperties read

Returns a DocumentProperties object that represents properties of the specified workbook, such as name, author, and summary

EncryptPassword String read
write

Sets or returns the password used to encrypt the spreadsheet

ExcludeMacros boolean read
write

Sets or returns whether ExcelWriter should remove macros from the generated workbook or leave them in

FirstDisplayedTab int read
write

Sets or returns the first worksheet tab to display in the tab bar at the bottom of the workbook window

Height int read
write

Sets or returns the height of the workbook's window

HorizontalPosition int read
write

Sets or returns the horizontal (x) position of the workbook window's upper left corner when displayed in Excel

IsProtected boolean read Returns whether or not the worksheet is protected.
Item (overloaded) read

Returns the worksheet specified by a 0-based index

NumberFormat NumberFormat read

Returns the NumberFormat used for formatting of numbers and dates

Palette Palette read

Returns a Palette object that represents the specified workbook's color palette

PasswordToModify String write

This sets the workbook so that it can be opened in read-only mode with the option to open in read-write mode, if the user supplies a matching password when opening the spreadsheet

ProtectPasswordHash int read
write

Sets or returns the password hash that is used to protect the workbook

ReadOnly boolean read
write

Determines whether the workbook can only be opened in read-only mode

ReadOnlyRecommended boolean read
write

Sets or returns whether Excel will recommend - when the workbook is opened - that it be viewed in read-only mode

ShowHorizontalScrollBar boolean read
write

When true, the horizontal scroll bar will be shown in the generated workbook

ShowVerticalScrollBar boolean read
write

Shows or hides the vertical scroll bar in the generated workbook

TabRatio double read
write

Sets or returns the ratio between the workbook's tab bar and the horizontal scroll bar

UseRCFormulaNotation boolean read
write

Indicates or sets the type of references used in this workbook

VerticalPosition int read
write

Sets or returns the vertical (y) position of the workbook window's upper left corner when displayed in Excel

Width int read
write

Sets or returns the width of the workbook's window

Worksheets Worksheets read

Returns a Worksheets collection which provides access to all worksheets in the specified workbook, including charts displayed as sheets



Workbook Methods

ReturnsSignature and Description
ConditionalFormat CreateConditionalFormat ( )

Creates a new ConditionalFormat object that can be set on Cells, {a href="Area.aspx"}Areas and {a href="Range.aspx"}Ranges

DataImportProperties CreateDataImportProperties ( )

Creates a DataImportProperties object that contains a set of properties that can be used when importing data to a Worksheet or Area

DataValidation CreateDataValidation ( DataValidation.ValidationType allowedType , DataValidation.ComparisonType comparison , Object minimumValue , Object maximumValue )

Creates a DataValidation object which can be set on a Range, {a href="Area.aspx"}Area, or Cell.

DataValidation CreateDataValidation ( DataValidation.ValidationType allowedType , DataValidation.ComparisonType comparison , Object value )

Creates a DataValidation object which can be set on a Range, {a href="Area.aspx"}Area, or Cell.

DataValidation CreateDataValidation ( DataValidation.ValidationType allowedType , DataValidation.ComparisonType comparison , String minimumValue , String maximumValue )

Creates a DataValidation object which can be set on a Range, {a href="Area.aspx"}Area, or Cell.

DataValidation CreateDataValidation ( DataValidation.ValidationType allowedType , DataValidation.ComparisonType comparison , String value )

Creates a DataValidation object which can be set on a Range, {a href="Area.aspx"}Area, or Cell.

DataValidation CreateDataValidation ( DataValidation.ValidationType allowedType , Object sourceArray )

Creates a DataValidation object which can be set on a Range, {a href="Area.aspx"}Area, or Cell.

DataValidation CreateDataValidation ( DataValidation.ValidationType allowedType , String formula )

Creates a DataValidation object which can be set on a Range, {a href="Area.aspx"}Area, or Cell.

Range CreateNamedRange ( Area[] rangeAreas , String rangeName )

Creates a Range of cells from an array of Areas

Range CreateNamedRange ( String rangeFormula , String rangeName )

Creates a named Range of cells from a specified formula

NamedStyle CreateNamedStyle ( String styleName )

Creates a named global style, which can be bound to cells, areas, ranges, rows, and columns

Range CreateRange ( Area[] rangeAreas )

Creates a Range of cells from an array of Areas

Range CreateRange ( String rangeFormula )

Creates a Range of cells from a specified formula

GlobalStyle CreateStyle ( )

Creates a global style, which can be bound to cells, areas, ranges, rows, and columns

NamedObject GetNamedObject ( String name )

Returns the NamedObject object that represents the name of a specified array, number, picture, or range

Range GetNamedRange ( String name )

Returns the specified named Range

NamedStyle GetNamedStyle ( String styleName )

Returns a NamedStyle if it exists

void Protect ( String password )

Protects the workbook using the supplied password for protecting.

void Unprotect ( )

Removes protection from the workbook



Copyright 2006 © SoftArtisans, Inc. All Rights Reserved.