Click or drag to resize

Workbook Properties

The Workbook type exposes the following members.

Properties
Name Description
Public property ActiveSheet
Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active. Read-only.
Public property ActiveSheetIndex
Gets or sets index of the active worksheet.
Public property AddInFunctions
Returns collection of add-in functions.
Public property Static member AIHelper
helper for call AI.
Public property Allow3DRangesInDataValidation
Indicates whether to allow usage of 3D ranges in DataValidation list property (MS Excel doesn't allow).
Public property CalculationMode
Get or set calculation mode.
Public property Charts
Returns a Sheets collection that represents all the chart sheets in the specified workbook. Read-only.
Public property Chartsheets
Gets a list of chartsheets in the Excel workbook.
Public property CheckComptiliblity
Indicates whether check comptiliblity when saving workbook.
Public property CodeName
Name which used by macros to access to workbook items.
Public property Code example Colors
Returns colors in the palette for the workbook. The palette has 56 entries, each represented by an RGB value. Read/write Object.
Examples
The following code illustrates how to access the default colors of excel color palette:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Get colors</para><para>System.Drawing.Color[] colors = workbook.Colors;</para><para>//Get color</para><para>System.Drawing.Color color = colors[2];</para><para>//Set color</para><para>worksheet["B2"].Style.Color = color;</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
Public property ConverterSetting
Gets or sets the converter settings for the Excel workbook.
Public property CultureInfo
Gets or sets the culture information used for formatting and parsing. This setting is equivalent to setting the editing language of Excel.
Public property Code example CustomDocumentProperties
Returns collection that represents all the custom document properties for the specified workbook. Read-only.
Examples
The following code snippet illustrates how to get the custom document properties:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Get the document properties</para><para>ICustomDocumentProperties documentProperties = workbook.CustomDocumentProperties;</para>
Public property CustomFontFileDirectory
Sets the custom directory of font files.
Public property CustomFontFilePaths
Returns or sets the custom path of font files.
Public property CustomTableStyles
Gets the custom table styles defined in the Excel workbook.
Public property DataConns
Gets the collection of data connections associated with the workbook.
Public property DataSorter
Gets Data sorter to sort the data..
Public property Date1904
True if the workbook uses the 1904 date system. Read/write Boolean.
Public property Code example DefaultFontName
Returns or sets the name of the default font.
Examples
The following code illustrates how to set the standard font for the workbook:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["B2"].Text = "Text";</para><para>//Set standard font</para><para>workbook.DefaultFontName = "Arial";</para><para>//Set standard font size</para><para>workbook.DefaultFontSize = 18;</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
Public property Code example DefaultFontSize
Returns or sets the default font size.
Examples
The following code illustrates how to set the standard font size for the workbook:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set text</para><para>worksheet["B2"].Text = "Text";</para><para>//Set standard font</para><para>workbook.DefaultFontName = "Arial";</para><para>//Set standard font size</para><para>workbook.DefaultFontSize = 18;</para><para>//Save to file</para><para>workbook.SaveToFile("CellFormats.xlsx");</para>
Public property DisableMacrosStart
Allows users to disable load of macros from document.
Public property Code example DocumentProperties
Returns a BuiltInDocumentProperties collection that represents all the built-in document properties for the specified workbook. Read-only.
Examples
The following code snippet illustrates how to get the built in document properties:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Get the built in document properties</para><para>IBuiltInDocumentProperties builtInDocumentProperties = workbook.DocumentProperties;</para>
Public property ExternalLinks
Gets the collection of external links in the workbook.
Public property FileName
Gets file name.
Public property HasMacros
Indicates whether contains VBA macros.
Public property HasTrackedChanges
Indicates whether the workbook has any tracked changes
Public property IsCellProtection
Indicates whether cells are protected.
Public property IsDigitallySigned
Indicates whether this spreadsheet is digitally signed.
Public property IsHideWindow
Hide window
Public property Code example IsHScrollBarVisible
Returns or sets whether show horizontal scroll bar.
Examples
This sample shows how to hide horizontal scroll bar:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>//Hide horizontal scroll bar</para><para>workbook.IsHScrollBarVisible = false;</para><para>//Save to file</para><para>workbook.SaveToFile("IsHScrollBarVisible.xlsx");</para>
Public property IsRightToLeft
Indicates whether worksheet is displayed right to left.
Public property IsSaved
Indicates whether workbook changes have been saved.
Public property Code example IsVScrollBarVisible
Returns or sets whether show vertical scroll bar.
Examples
This sample shows how to hide vertical scroll bar:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>//Hide vertical scroll bar</para><para>workbook.IsVScrollBarVisible = false;</para><para>//Save to file</para><para>workbook.SaveToFile("IsVScrollBarVisible.xlsx");</para>
Public property IsWindowProtection
Indicates window is protected.
Public property MarkerDesigner
Gets the MarkerDesigner instance.
Public property MaxColumnCount
Returns maximum column count for each worksheet in this workbook. Read-only.
Public property MaxDigitWidth
Gets the maximum digit width in the Excel workbook.
Public property MaxRowCount
Returns maximum row count for each worksheet in this workbook. Read-only.
Public property MaxRowsOfSharedFormula
Gets or sets the maximum number of rows for shared formulas in the workbook.
Public property Code example NameRanges
Gets Names collection that represents all the names in the specified workbook.
Examples
The following code snippet illustrates how to get names:
<para>//Create workbook</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>//Get names</para><para>INameRanges names = workbook.NameRanges;</para>
Public property OpenPassword
Returns or sets password to encrypt document.
Public property OptimizeImport
Indicates whether to optimize Import data. This option will take effect only on Import methods that are available with the worksheet WARNING: Setting this property to True can decrease memory significantly, but will increase the performance of data import .
Public property Code example PivotCaches
Returns pivot caches collection. Read-only.
Examples
The following code snippet illustrates how to get pivot caches:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>workbook.LoadFromFile("Sample.xlsx");</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Gets pivot caches collection</para><para>IPivotCaches pivotCaches = workbook.PivotCaches;</para>
Public property PrintDialog
Sets the print dialog for the current instance.
Public property PrintDocument
Gets the PrintDocument
Public property ProhibitDtd
prohibt dtd processing switch
Public property ReadOnly
Indicates whether the workbook has been opened as Read-only.
Public property SelectedTab
Gets or sets tab index of selected.
Public property SheetTabBarWidth
Returns or sets the width of worksheet tab bar. 1/1000 of window width.
Public property ShowTabs
Get or sets a value whether the Workbook tabs are displayed.
Public property Code example Styles
Returns a Styles collection that represents all the styles in the specified workbook. Read-only.
Examples
The following code snippet illustrates how to get the Styles:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Set styles</para><para>IStyles styles = workbook.Styles;</para>
Public property TrackedChanges
Turn revision mode on or off.
Public property UseStorageMode
User Compound storage mode
Public property Version
Gets or sets the version of the Excel workbook.
Public property Worksheets
Returns a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.
Public property WriteProtection
Returns options of the workbook write protection.
Top
See Also