Show / Hide Table of Contents

Class ExcelWorkbook

Represents the Excel workbook and provides access to all the document properties and worksheets within the workbook.

Inheritance
System.Object
XmlHelper
ExcelWorkbook
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: OfficeOpenXml
Assembly: EPPlus.dll
Syntax
public sealed class ExcelWorkbook : XmlHelper, IDisposable

Properties

CalcMode

Calculation mode for the workbook.

Declaration
public ExcelCalcMode CalcMode { get; set; }
Property Value
Type Description
ExcelCalcMode

CodeModule

The VBA code module if the package has a VBA project. Otherwise this propery is null. CreateVBAProject()

Declaration
public ExcelVBAModule CodeModule { get; }
Property Value
Type Description
ExcelVBAModule

Date1904

The date systems used by Microsoft Excel can be based on one of two different dates. By default, a serial number of 1 in Microsoft Excel represents January 1, 1900. The default for the serial number 1 can be changed to represent January 2, 1904. This option was included in Microsoft Excel for Windows to make it compatible with Excel for the Macintosh, which defaults to January 2, 1904.

Declaration
public bool Date1904 { get; set; }
Property Value
Type Description
System.Boolean

DefaultThemeVersion

The default version of themes to apply in the workbook

Declaration
public int? DefaultThemeVersion { get; set; }
Property Value
Type Description
System.Nullable<System.Int32>

FormulaParserManager

Manage the formula parser. Add your own functions or replace native ones, parse formulas or attach a logger.

Declaration
public FormulaParserManager FormulaParserManager { get; }
Property Value
Type Description
FormulaParserManager

FullCalcOnLoad

Should Excel do a full calculation after the workbook has been loaded? This property is always true for both new workbooks and loaded templates(on load). If this is not the wanted behavior set this property to false.

Declaration
public bool FullCalcOnLoad { get; set; }
Property Value
Type Description
System.Boolean

HasLoadedPivotTables

Declaration
public bool HasLoadedPivotTables { get; }
Property Value
Type Description
System.Boolean

MaxFontWidth

Max font width for the workbook This method uses GDI. If you use Azure or another environment that does not support GDI, you have to set this value manually if you don't use the standard Calibri font

Declaration
public decimal MaxFontWidth { get; set; }
Property Value
Type Description
System.Decimal

Names

Provides access to named ranges

Declaration
public ExcelNamedRangeCollection Names { get; }
Property Value
Type Description
ExcelNamedRangeCollection

Properties

The office document properties

Declaration
public OfficeProperties Properties { get; }
Property Value
Type Description
OfficeProperties

Protection

Access properties to protect or unprotect a workbook

Declaration
public ExcelProtection Protection { get; }
Property Value
Type Description
ExcelProtection

Styles

Package styles collection. Used internally to access style data.

Declaration
public ExcelStyles Styles { get; }
Property Value
Type Description
ExcelStyles

StylesXml

Provides access to the XML data representing the styles in the package.

Declaration
public XmlDocument StylesXml { get; set; }
Property Value
Type Description
System.Xml.XmlDocument

ThemeManager

Create and manage the theme for the workbook.

Declaration
public ExcelThemeManager ThemeManager { get; }
Property Value
Type Description
ExcelThemeManager

ThreadedCommentPersons

Represents a collection of ExcelThreadedCommentPersons in the workbook.

Declaration
public ExcelThreadedCommentPersonCollection ThreadedCommentPersons { get; }
Property Value
Type Description
ExcelThreadedCommentPersonCollection

VbaProject

A reference to the VBA project. Null if no project exists. Use Workbook.CreateVBAProject to create a new VBA-Project

Declaration
public ExcelVbaProject VbaProject { get; }
Property Value
Type Description
ExcelVbaProject

View

Access to workbook view properties

Declaration
public ExcelWorkbookView View { get; }
Property Value
Type Description
ExcelWorkbookView

WorkbookXml

Provides access to the XML data representing the workbook in the package.

Declaration
public XmlDocument WorkbookXml { get; }
Property Value
Type Description
System.Xml.XmlDocument

Worksheets

Provides access to all the worksheets in the workbook. Note: Worksheets index either starts by 0 or 1 depending on the Excelpackage.Compatibility.IsWorksheets1Based property. Default is 1 for .Net 3.5 and .Net 4 and 0 for .Net Core.

Declaration
public ExcelWorksheets Worksheets { get; }
Property Value
Type Description
ExcelWorksheets

Methods

ClearFormulas()

Removes all formulas within the entire workbook, but keeps the calculated values.

Declaration
public void ClearFormulas()

ClearFormulaValues()

Removes all values of cells with formulas in the entire workbook, but keeps the formulas.

Declaration
public void ClearFormulaValues()

CreateVBAProject()

Create an empty VBA project.

Declaration
public void CreateVBAProject()

Dispose()

Disposes the workbooks

Declaration
public void Dispose()

RemoveVBAProject()

Remove the from the file VBA project.

Declaration
public void RemoveVBAProject()

Implements

System.IDisposable

Extension Methods

CalculationExtension.Calculate(ExcelWorkbook)
CalculationExtension.Calculate(ExcelWorkbook, Action<ExcelCalculationOption>)
CalculationExtension.Calculate(ExcelWorkbook, ExcelCalculationOption)
In This Article
Back to top Generated by DocFX