Represents a Microsoft Excel workbook.
Inheritance
object
Constructors
Section titled "Constructors"constructor
public Workbook() Returns Workbook
constructor
public Workbook(WorkbookFormat format) Returns Workbook
Properties
Section titled "Properties"CalculationMode
Section titled "CalculationMode"Gets or sets the value which indicates how a formula will be recalculated when a referenced value changes.
public CalculationMode CalculationMode { get; set; } CellReferenceMode
Section titled "CellReferenceMode"Gets or sets the value which indicates the way cells in the workbook are referenced.
public CellReferenceMode CellReferenceMode { get; set; } Culture
Section titled "Culture"Gets or sets the culture to use as the current culture for the workbook when doing any culture-aware conversions or comparisons.
public CultureInfo Culture { get; set; } CurrentFormat
Section titled "CurrentFormat"Gets the current format of the workbook. This is the format which will be used when saving and imposing format restrictions.
public WorkbookFormat CurrentFormat { get; } CustomTableStyles
Section titled "CustomTableStyles"Gets the collection of custom table styles in the workbook.
public CustomTableStyleCollection CustomTableStyles { get; } CustomViews
Section titled "CustomViews"Gets the collection of custom views for the workbook.
public CustomViewCollection CustomViews { get; } DateSystem
Section titled "DateSystem"Gets or sets the date system used internally by Microsoft Excel.
public DateSystem DateSystem { get; set; } DefaultTableStyle
Section titled "DefaultTableStyle"Gets or sets the default style for tables in the workbook.
public WorksheetTableStyle DefaultTableStyle { get; set; } DocumentProperties
Section titled "DocumentProperties"Gets the properties associated with the workbook document.
public DocumentProperties DocumentProperties { get; } EditingCulture
Section titled "EditingCulture"The editing culture affects certain language specific features such as formatting of dates. or comparisons.
public CultureInfo EditingCulture { get; set; } FileWriteProtectedBy
Section titled "FileWriteProtectedBy"Gets the name of the user who initially added file write protection to the document.
public string FileWriteProtectedBy { get; } HasFileWriteProtectionPassword
Section titled "HasFileWriteProtectionPassword"Gets the value indicating whether the has a file write protection password that will be used to protect saved files or streams.
public bool HasFileWriteProtectionPassword { get; } HasOpenPassword
Section titled "HasOpenPassword"Gets the value indicating whether the has an open password and will therefore be encrypted on subsequent saves.
public bool HasOpenPassword { get; } HasProtectionPassword
Section titled "HasProtectionPassword"Returns a boolean indicating if the Workbook has been protected with a password.
public bool HasProtectionPassword { get; } InProcessRuntime
Section titled "InProcessRuntime"Provides the in process runtime that the workbook can use to perform operations in javascript.
public static IJSInProcessRuntime InProcessRuntime { get; set; } IsFileWriteProtected
Section titled "IsFileWriteProtected"Gets the value indicating whether the was loaded with file write protection and the correct password has not yet been provided to ValidateFileWriteProtectionPassword.
public bool IsFileWriteProtected { get; } IsProtected
Section titled "IsProtected"Returns a boolean indicating if the Workbook has been protected.
public bool IsProtected { get; } IterativeCalculationsEnabled
Section titled "IterativeCalculationsEnabled"Gets or sets the value which indicates whether iterations are allowed while calculating formulas containing circular references.
public bool IterativeCalculationsEnabled { get; set; } MaxChangeInIteration
Section titled "MaxChangeInIteration"Gets or sets the maximum change of the values in a formula between iterations which will exit from iteration.
public double MaxChangeInIteration { get; set; } MaxColumnCount
Section titled "MaxColumnCount"Gets the maximum number of columns allowed in each worksheet based on the .
public int MaxColumnCount { get; } MaxRecursionIterations
Section titled "MaxRecursionIterations"Gets or sets the maximum number of times formulas should be iteratively calculated.
public int MaxRecursionIterations { get; set; } MaxRowCount
Section titled "MaxRowCount"Gets the maximum number of rows allowed in each worksheet based on the .
public int MaxRowCount { get; } NamedReferences
Section titled "NamedReferences"Gets the collection of named references in the workbook.
public NamedReferenceCollection NamedReferences { get; } Palette
Section titled "Palette"Gets the color palette used when the saved file is opened in Microsoft Excel 2003 and earlier versions.
public WorkbookColorPalette Palette { get; } Precision
Section titled "Precision"Gets or sets the precision to use when obtaining a cell's value.
public Precision Precision { get; set; } Protected
Section titled "Protected"Gets or sets the value which indicates whether the workbook is protected.
[Obsolete("The Protected property has been deprecated. The IsProtected property will return the current protected state. The Protect and Unprotect methods are used to change the protection state.")]
public bool Protected { get; set; } Protection
Section titled "Protection"Returns an object that provides information used when the Workbook has been protected.
public WorkbookProtection Protection { get; } RecalculateBeforeSave
Section titled "RecalculateBeforeSave"Gets or sets the value which indicates whether the workbook should recalculate all formulas before saving.
public bool RecalculateBeforeSave { get; set; } SaveExternalLinkedValues
Section titled "SaveExternalLinkedValues"Gets or sets the value which indicates whether to save values linked from external workbooks.
public bool SaveExternalLinkedValues { get; set; } ScreenDpi
Section titled "ScreenDpi"Gets or sets the Dpi to use when calculating row and column sizes for the workbook. If empty, the system Dpi will be used.
public Size ScreenDpi { get; set; } Sheets
Section titled "Sheets"Gets the collection of sheets in the workbook.
public SheetCollection Sheets { get; } ShouldRemoveCarriageReturnsOnSave
Section titled "ShouldRemoveCarriageReturnsOnSave"Gets or sets the value which indicates whether carriage return characters should be removed from string values in cells when the workbook is saved to an Excel file.
public bool ShouldRemoveCarriageReturnsOnSave { get; set; } StandardTableStyles
Section titled "StandardTableStyles"Gets the read-only collection of preset table styles in the workbook.
public StandardTableStyleCollection StandardTableStyles { get; } Styles
Section titled "Styles"Gets the collection of custom styles in the workbook.
public WorkbookStyleCollection Styles { get; } SystemDpi
Section titled "SystemDpi"Gets or sets the default Dpi to use when calculating row and column sizes for the workbook. If empty, the resolved system Dpi will be used.
public static Size SystemDpi { get; set; } ValidateFormatStrings
Section titled "ValidateFormatStrings"Gets or sets the value indicating whether the format strings should be validated when they are set.
public bool ValidateFormatStrings { get; set; } WindowOptions
Section titled "WindowOptions"Gets the options which control various workbook level display properties.
public WorkbookWindowOptions WindowOptions { get; } Worksheets
Section titled "Worksheets"Gets the collection of worksheets in the workbook.
public WorksheetCollection Worksheets { get; } Accessors
Section titled "Accessors"MaxExcel2007CellFormatCount
Section titled "MaxExcel2007CellFormatCount"Maximum number of distinct cell formats in the workbook allowed by the Excel 2007 file format.
public const int MaxExcel2007CellFormatCount = 64000 MaxExcel2007ColumnCount
Section titled "MaxExcel2007ColumnCount"Maximum number of columns in the worksheet allowed by the Excel 2007 file format.
public const int MaxExcel2007ColumnCount = 16384 MaxExcel2007RowCount
Section titled "MaxExcel2007RowCount"Maximum number of rows in the worksheet allowed by the Excel 2007 file format.
public const int MaxExcel2007RowCount = 1048576 MaxExcelCellFormatCount
Section titled "MaxExcelCellFormatCount"Maximum number of distinct cell formats in the workbook allowed by the Excel 97-2003 file format.
public const int MaxExcelCellFormatCount = 4000 MaxExcelColumnCount
Section titled "MaxExcelColumnCount"Maximum number of columns in the worksheet allowed by the Excel 97-2003 file format.
public const int MaxExcelColumnCount = 256 MaxExcelRowCount
Section titled "MaxExcelRowCount"Maximum number of rows in the worksheet allowed by the Excel 97-2003 file format.
public const int MaxExcelRowCount = 65536 MaxExcelWorkbookFonts
Section titled "MaxExcelWorkbookFonts"Maximum number fonts in a workbook allowed by Excel.
public const int MaxExcelWorkbookFonts = 512 Methods
Section titled "Methods"CharacterWidth256thsToPixels(double)
Section titled "CharacterWidth256thsToPixels(double)"Converts units of 1/256s of the average character width to pixels.
public double CharacterWidth256thsToPixels(double characterWidth256ths) Parameters
- characterWidth256ths:
double
Returns any
ClearConnectionData()
Section titled "ClearConnectionData()"Clears all external data connections from the .
public void ClearConnectionData() Returns any
ClearPivotTableData()
Section titled "ClearPivotTableData()"Clears all pivot tables and associated slicers from the .
public void ClearPivotTableData() Returns any
ClearVbaData()
Section titled "ClearVbaData()"Clears all vba information from the .
public void ClearVbaData() Returns any
CreateNewWorkbookFont()
Section titled "CreateNewWorkbookFont()"Factory method which creates new workbook font.
public IWorkbookFont CreateNewWorkbookFont() Returns any
CreateNewWorksheetCellFormat()
Section titled "CreateNewWorksheetCellFormat()"Creates new worksheet cell format.
public IWorksheetCellFormat CreateNewWorksheetCellFormat() Returns any
GetMaxColumnCount(WorkbookFormat)
Section titled "GetMaxColumnCount(WorkbookFormat)"Returns the number of columns that are supported by the specified format.
public static int GetMaxColumnCount(WorkbookFormat format) Parameters
- format:
WorkbookFormat
Returns any
GetMaxRowCount(WorkbookFormat)
Section titled "GetMaxRowCount(WorkbookFormat)"Returns the number of rows that are supported by the specified format.
public static int GetMaxRowCount(WorkbookFormat format) Parameters
- format:
WorkbookFormat
Returns any
GetTable(string)
Section titled "GetTable(string)"Gets the table with the specified name.
public WorksheetTable GetTable(string name) Parameters
- name:
string
Returns any
GetWorkbookFormat(string)
Section titled "GetWorkbookFormat(string)"Returns the WorkbookFormat based on the file extension of the specified file.
public static WorkbookFormat? GetWorkbookFormat(string fileName) Parameters
- fileName:
string
Returns any
IsValidFunctionName(string)
Section titled "IsValidFunctionName(string)"Gets a value indicating whether the specified function will be recognized and solved by Microsoft Excel when the workbook is saved out.
public bool IsValidFunctionName(string functionName) Parameters
- functionName:
string
Returns any
IsWorkbookEncrypted(Stream)
Section titled "IsWorkbookEncrypted(Stream)"Determines whether the workbook in the specified stream is encrypted with an open password.
public static bool IsWorkbookEncrypted(Stream stream) Parameters
- stream:
Stream
Returns any
Load(Stream, WorkbookLoadOptions)
Section titled "Load(Stream, WorkbookLoadOptions)"Reads a workbook from a stream.
public static Workbook Load(Stream stream, WorkbookLoadOptions loadOptions = null) Parameters
- stream:
Stream - loadOptions:
WorkbookLoadOptions
Returns any
PixelsToCharacterWidth256ths(double)
Section titled "PixelsToCharacterWidth256ths(double)"Converts pixels to units of 1/256s of the average character width.
public double PixelsToCharacterWidth256ths(double pixels) Parameters
- pixels:
double
Returns any
Protect(bool, bool)
Section titled "Protect(bool, bool)"Protects the Workbook without a password.
public void Protect(bool allowEditStructure = false, bool allowEditWindows = true) Parameters
- allowEditStructure:
bool - allowEditWindows:
bool
Returns any
Protect(SecureString, bool, bool)
Section titled "Protect(SecureString, bool, bool)"Protects the worksheet with the specified password.
public void Protect(SecureString password, bool allowEditStructure = false, bool allowEditWindows = true) Parameters
- password:
SecureString - allowEditStructure:
bool - allowEditWindows:
bool
Returns any
Protect(string, bool, bool)
Section titled "Protect(string, bool, bool)"Protects the worksheet with the specified password.
public void Protect(string password, bool allowEditStructure = false, bool allowEditWindows = true) Parameters
- password:
string - allowEditStructure:
bool - allowEditWindows:
bool
Returns any
Recalculate()
Section titled "Recalculate()"Recalculates all dirty formulas pending a calculation on the workbook.
public void Recalculate() Returns any
Recalculate(bool)
Section titled "Recalculate(bool)"Recalculates all formulas on the workbook.
public void Recalculate(bool includeNonDirtyFormulas) Parameters
- includeNonDirtyFormulas:
bool
Returns any
RegisterUserDefinedFunction(ExcelCalcFunction)
Section titled "RegisterUserDefinedFunction(ExcelCalcFunction)"Registers a single instance.
public bool RegisterUserDefinedFunction(ExcelCalcFunction userDefinedFunction) Parameters
- userDefinedFunction:
ExcelCalcFunction
Returns any
RegisterUserDefinedFunctionLibrary(Assembly)
Section titled "RegisterUserDefinedFunctionLibrary(Assembly)"Registers an assembly containing derived types.
public bool RegisterUserDefinedFunctionLibrary(Assembly assembly) Parameters
- assembly:
Assembly
Returns any
ResumeCalculations()
Section titled "ResumeCalculations()"Resumes the calculation of formulas.
public void ResumeCalculations() Returns any
Save(Stream, IPackageFactory)
Section titled "Save(Stream, IPackageFactory)"Writes the workbook to a stream.
public void Save(Stream stream, IPackageFactory packageFactory) Parameters
- stream:
Stream - packageFactory:
IPackageFactory
Returns any
Save(Stream, WorkbookSaveOptions)
Section titled "Save(Stream, WorkbookSaveOptions)"Writes the workbook to a stream.
public void Save(Stream stream, WorkbookSaveOptions saveOptions = null) Parameters
- stream:
Stream - saveOptions:
WorkbookSaveOptions
Returns any
SetCurrentFormat(WorkbookFormat)
Section titled "SetCurrentFormat(WorkbookFormat)"Sets the current format of the workbook.
public void SetCurrentFormat(WorkbookFormat format) Parameters
- format:
WorkbookFormat
Returns any
SetEncryptionMode(WorkbookEncryptionMode)
Section titled "SetEncryptionMode(WorkbookEncryptionMode)"Sets the encryption modes to use to encrypt documents saved in the 2007 file formats and later.
public void SetEncryptionMode(WorkbookEncryptionMode encryptionMode) Parameters
- encryptionMode:
WorkbookEncryptionMode
Returns any
SetFileWriteProtectionPassword(SecureString, string)
Section titled "SetFileWriteProtectionPassword(SecureString, string)"Sets the password used to protect the file from automatic writes.
public void SetFileWriteProtectionPassword(SecureString password, string userName = null) Parameters
- password:
SecureString - userName:
string
Returns any
SetFileWriteProtectionPassword(string, string)
Section titled "SetFileWriteProtectionPassword(string, string)"Sets the password used to protect the file from automatic writes.
public void SetFileWriteProtectionPassword(string password, string userName = null) Parameters
- password:
string - userName:
string
Returns any
SetOpenPassword(SecureString)
Section titled "SetOpenPassword(SecureString)"Sets the password used to encrypt the document on subsequent saves.
public void SetOpenPassword(SecureString password) Parameters
- password:
SecureString
Returns any
SetOpenPassword(string)
Section titled "SetOpenPassword(string)"Sets the password used to encrypt the document on subsequent saves.
public void SetOpenPassword(string password) Parameters
- password:
string
Returns any
SuspendCalculations()
Section titled "SuspendCalculations()"Temporarily suspends the calculation of formulas.
public void SuspendCalculations() Returns any
Unprotect()
Section titled "Unprotect()"Removes the Workbook protection.
public void Unprotect() Returns any
Unprotect(SecureString)
Section titled "Unprotect(SecureString)"Attempts to use the specified password to remove the Worksheet protection currently in place.
public void Unprotect(SecureString password) Parameters
- password:
SecureString
Returns any
Unprotect(string)
Section titled "Unprotect(string)"Attempts to use the specified password to remove the Worksheet protection currently in place.
public void Unprotect(string password) Parameters
- password:
string
Returns any
ValidateFileWriteProtectionPassword(SecureString)
Section titled "ValidateFileWriteProtectionPassword(SecureString)"Validates the password for a loaded with file write protection. and returns the value indicating whether the protection was successfully disabled.
public bool ValidateFileWriteProtectionPassword(SecureString password) Parameters
- password:
SecureString
Returns any
ValidateFileWriteProtectionPassword(string)
Section titled "ValidateFileWriteProtectionPassword(string)"Validates the password for a loaded with file write protection. and returns the value indicating whether the protection was successfully disabled.
public bool ValidateFileWriteProtectionPassword(string password) Parameters
- password:
string