• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class Workbook

Represents a spreadsheet workbook containing worksheets, chartsheets, and other sheet types.

Inheritance
object
Workbook
Implements
IDisposable
Inherited Members
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class Workbook : IDisposable
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Examples
// Create a new workbook and add data
var workbook = new Workbook();
var worksheet = workbook.Worksheets.Add("Sheet1");
worksheet.Cells["A1"].Value = "Hello, World!";
workbook.Save("output.xlsx");

Constructors

Workbook()

Initializes a new Workbook for the supplied workbook data.

Declaration
public Workbook()
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Workbook(WorkbookCreationArguments)

Initializes a new Workbook for the supplied workbook data.

Declaration
public Workbook(WorkbookCreationArguments arguments)
Parameters
Type Name Description
WorkbookCreationArguments arguments
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Workbook(string)

Initializes a new Workbook for the supplied workbook data.

Declaration
public Workbook(string path)
Parameters
Type Name Description
string path
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Workbook(string, FormatType)

Initializes a new Workbook for the supplied workbook data.

Declaration
public Workbook(string path, FormatType formatType)
Parameters
Type Name Description
string path
FormatType formatType
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Workbook(string, FormatType, string)

Opens a workbook from disk using explicit format and password.

Declaration
public Workbook(string path, FormatType formatType, string password)
Parameters
Type Name Description
string path
FormatType formatType
string password
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Workbook(string, string)

Opens a workbook from disk using the specified password.

Declaration
public Workbook(string path, string password)
Parameters
Type Name Description
string path
string password
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Fields

Views

Gets the list of workbook views.

Declaration
public List<WorkbookView> Views
Field Value
Type Description
List<WorkbookView>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Properties

ActiveView

Gets the active workbook view.

Declaration
public WorkbookView ActiveView { get; }
Property Value
Type Description
WorkbookView
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Author

Specifies the author name for write protection.

Declaration
public string Author { get; set; }
Property Value
Type Description
string
Remarks

This maps to the OpenXML fileSharing@userName setting.

BuiltInStyles

Gets the built-in styles in the workbook.

Declaration
public IEnumerable<StyleSheetCellStyle> BuiltInStyles { get; }
Property Value
Type Description
IEnumerable<StyleSheetCellStyle>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

CalculationProperties

Specifies the calculation properties.

Declaration
public CalculationProperties CalculationProperties { get; set; }
Property Value
Type Description
CalculationProperties
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

CellStyles

Gets all the cell styles in the workbook.

Declaration
public IEnumerable<StyleSheetCellStyle> CellStyles { get; }
Property Value
Type Description
IEnumerable<StyleSheetCellStyle>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

CircularReferences

Returns the circular references detected during the last Calculate call. Each entry identifies one cell that is part of a circular dependency chain. The list is cleared and repopulated on every subsequent Calculate call.

Declaration
public IReadOnlyList<CircularReference> CircularReferences { get; }
Property Value
Type Description
IReadOnlyList<CircularReference>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Connections

Get or set the data connections

Declaration
public List<DataConnection> Connections { get; set; }
Property Value
Type Description
List<DataConnection>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

ConversionDiagnostics

Gets read-only outcomes from the most recent cross-format conversion. The snapshot contains semantic diagnostics without exposing format implementation types.

Declaration
public ConversionIssueCollection ConversionDiagnostics { get; }
Property Value
Type Description
ConversionIssueCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

CustomWorkbookViews

Gets the collection of custom workbook views.

Declaration
public List<CustomWorkbookView> CustomWorkbookViews { get; }
Property Value
Type Description
List<CustomWorkbookView>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

CustomXmlParts

Gets the collection of custom XML parts in the workbook.

Declaration
public CustomXmlPartCollection CustomXmlParts { get; }
Property Value
Type Description
CustomXmlPartCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

DefaultThemeFont

Gets the default theme font.

Declaration
public string DefaultThemeFont { get; }
Property Value
Type Description
string
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

DefinedNames

Gets the collection of defined names in the workbook.

Declaration
public DefinedNameCollection DefinedNames { get; }
Property Value
Type Description
DefinedNameCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

DocumentProperties

Gets the document properties for the workbook.

Declaration
public DocumentProperties DocumentProperties { get; }
Property Value
Type Description
DocumentProperties
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

ExternalConnections

Gets a typed collection of external data connections. This is a convenience wrapper over Connections providing indexed and named access, plus factory methods for DatabaseConnection and WebQueryConnection. Excel UI: "Data > Get Data > Existing Connections".

Declaration
public ExternalConnectionCollection ExternalConnections { get; }
Property Value
Type Description
ExternalConnectionCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

FileName

Exposes the file name associated with Workbook.

Declaration
public string FileName { get; }
Property Value
Type Description
string

The file name returned by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

FilePath

Gets the file name of the workbook, if it was opened or already saved.

Declaration
public string FilePath { get; }
Property Value
Type Description
string
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

FileVersion

Gets the file version.

Declaration
public FileVersion FileVersion { get; }
Property Value
Type Description
FileVersion
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Format

Gets the format type of the workbook.

Declaration
public FormatType Format { get; }
Property Value
Type Description
FormatType
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

IsShared

Gets a value indicating whether the workbook is a shared workbook with change tracking enabled. A workbook is shared when it has revision logs or when CreateSharedWorkbook() has been called. Excel UI: "Review > Share Workbook".

Declaration
public bool IsShared { get; set; }
Property Value
Type Description
bool
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

IsStructureLocked

Returns true if the workbook structure is locked.

Declaration
public bool IsStructureLocked { get; }
Property Value
Type Description
bool
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Language

Exposes the language associated with Workbook.

Declaration
public string Language { get; set; }
Property Value
Type Description
string

The language returned by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

LoadErrors

Gets the list of load warnings encountered while loading the workbook.

Declaration
public IReadOnlyList<LoadWarning> LoadErrors { get; }
Property Value
Type Description
IReadOnlyList<LoadWarning>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Name

Specifies the name of the workbook.

Declaration
public string Name { get; }
Property Value
Type Description
string
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Properties

Get or set the workbook properties

Declaration
public WorkbookProperties Properties { get; set; }
Property Value
Type Description
WorkbookProperties
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Protection

Get or set the workbook protection

Declaration
public WorkbookProtection Protection { get; set; }
Property Value
Type Description
WorkbookProtection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

ReadOnlyRecommended

Gets or sets whether the workbook should prompt users to open it as read-only.

Declaration
public bool ReadOnlyRecommended { get; set; }
Property Value
Type Description
bool
Remarks

This maps to the OpenXML fileSharing@readOnlyRecommended setting.

RevisionLogs

Gets the collection of revision logs recorded for a shared workbook. Excel UI: "Review > Track Changes > Highlight Changes".

Declaration
public RevisionLogCollection RevisionLogs { get; }
Property Value
Type Description
RevisionLogCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SharedWorkbookSettings

Gets the shared-workbook change-history settings. These only take effect when IsShared is true. Excel UI: "Review > Share Workbook > Advanced".

Declaration
public SharedWorkbookSettings SharedWorkbookSettings { get; }
Property Value
Type Description
SharedWorkbookSettings
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Sheets

Get the collection of sheets in the workbook. In most cases, sheet are worksheets.

Declaration
public SheetCollection Sheets { get; }
Property Value
Type Description
SheetCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

StyleSheet

Gets the styles.

Declaration
public Styles StyleSheet { get; }
Property Value
Type Description
Styles
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

TableDefinedNames

Get the collection of defined names in the workbook

Declaration
public ObservableCollection<TableDefinedName> TableDefinedNames { get; }
Property Value
Type Description
ObservableCollection<TableDefinedName>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Theme

Get or set the theme of the workbook

Declaration
public Theme Theme { get; }
Property Value
Type Description
Theme
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

ThreadedCommentAuthors

Gets the collection of threaded comment authors in the workbook.

Declaration
public ThreadedCommentAuthorCollection ThreadedCommentAuthors { get; }
Property Value
Type Description
ThreadedCommentAuthorCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

VbaProject

Exposes the vba project associated with Workbook.

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

The vba project returned by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

WebPublishing

Specifies the web publishing settings for the workbook.

Declaration
public WebPublishing WebPublishing { get; set; }
Property Value
Type Description
WebPublishing
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Worksheets

Gets the collection of worksheets in the workbook.

Declaration
public WorksheetCollection Worksheets { get; }
Property Value
Type Description
WorksheetCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

XmlMaps

Gets the collection of XML maps in the workbook. Excel UI: "Developer > Source > XML Maps".

Declaration
public XmlMapCollection XmlMaps { get; }
Property Value
Type Description
XmlMapCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Methods

AddChartsheet()

Adds the supplied chartsheet to the Workbook.

Declaration
public Chartsheet AddChartsheet()
Returns
Type Description
Chartsheet

The add chartsheet returned by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

AddChartsheet(string)

Create a chart sheet and add it to the collection of sheets.

Declaration
public Chartsheet AddChartsheet(string name)
Parameters
Type Name Description
string name
Returns
Type Description
Chartsheet
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

AddWorksheet()

Create a new sheet and add it to the collection of sheets.

Declaration
public Worksheet AddWorksheet()
Returns
Type Description
Worksheet

The newly created sheet

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

AddWorksheet(string)

Adds the supplied worksheet to the Workbook.

Declaration
public Worksheet AddWorksheet(string name)
Parameters
Type Name Description
string name

The name used by the operation.

Returns
Type Description
Worksheet

The add worksheet returned by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

AppendDigitalSignature(string, XlsxDigitalSignatureSaveOptions)

Appends a single digital signature to an existing unencrypted XLSX package.

Declaration
public static void AppendDigitalSignature(string path, XlsxDigitalSignatureSaveOptions signature)
Parameters
Type Name Description
string path
XlsxDigitalSignatureSaveOptions signature
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

AppendDigitalSignatures(string, IEnumerable<XlsxDigitalSignatureSaveOptions>)

Appends multiple digital signatures to an existing unencrypted XLSX package.

Declaration
public static void AppendDigitalSignatures(string path, IEnumerable<XlsxDigitalSignatureSaveOptions> signatures)
Parameters
Type Name Description
string path
IEnumerable<XlsxDigitalSignatureSaveOptions> signatures
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Calculate()

Calculate all the worksheets in the workbook

Declaration
public void Calculate()
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Calculate(CancellationToken)

Calculate all the worksheets in the workbook, stopping early if cancellationToken is cancelled. Throws OperationCanceledException if cancellation is requested.

Declaration
public void Calculate(CancellationToken cancellationToken)
Parameters
Type Name Description
CancellationToken cancellationToken
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

CreateCalculationDisabler()

Create an object which disables calculation. When this object is disposed, all modified cells are calculated.

Declaration
public IDisposable CreateCalculationDisabler()
Returns
Type Description
IDisposable
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

CreateSharedWorkbook()

Marks the workbook as shared and enables change tracking. After calling this method, edits are recorded in RevisionLogs when the workbook is saved and re-opened. Excel UI: "Review > Share Workbook > Allow changes by more than one user".

Declaration
public void CreateSharedWorkbook()
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Dispose()

Exposes the dispose associated with Workbook.

Declaration
public void Dispose()
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

FindAll(FindArguments)

Finds all cells matching the specified arguments.

Declaration
public IEnumerable<Cell> FindAll(FindArguments arguments)
Parameters
Type Name Description
FindArguments arguments

The find arguments.

Returns
Type Description
IEnumerable<Cell>

The matching cells.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

GetPivotCaches()

Gets the collection of pivot caches in the workbook, used to create new PivotTables.

Declaration
public PivotCacheCollection GetPivotCaches()
Returns
Type Description
PivotCacheCollection
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

GetSheet(string)

Retrieves the requested sheet from the Workbook.

Declaration
public Sheet GetSheet(string name)
Parameters
Type Name Description
string name

The name used by the operation.

Returns
Type Description
Sheet

The get sheet returned by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

GetWorksheet(string)

Returns the sheet with a given name.

Declaration
public Worksheet GetWorksheet(string name)
Parameters
Type Name Description
string name

The name of the sheet. This is case insensitive

Returns
Type Description
Worksheet

The sheet

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

ListDigitalSignatures(string)

Lists digital signatures in an existing unencrypted XLSX package.

Declaration
public static IList<XlsxDigitalSignatureInfo> ListDigitalSignatures(string path)
Parameters
Type Name Description
string path
Returns
Type Description
IList<XlsxDigitalSignatureInfo>
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Load(Stream, FormatType)

Loads a workbook from a stream using the specified format. Supported formats: ExcelWorkbook (XLSX/XLSM/XLTX/XLTM) and ExcelBinaryWorkbook (XLSB).

Declaration
public static Workbook Load(Stream stream, FormatType formatType)
Parameters
Type Name Description
Stream stream

The stream containing the workbook data.

FormatType formatType

The format of the data in the stream.

Returns
Type Description
Workbook

A loaded Workbook instance.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Exceptions
Type Condition
ArgumentNullException

Thrown when stream is null.

NotSupportedException

Thrown when formatType is not a stream-supported format.

Load(string)

Loads a workbook from disk by inferring format from file extension.

Declaration
public static Workbook Load(string path)
Parameters
Type Name Description
string path
Returns
Type Description
Workbook
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Load(string, CsvLoadOptions)

Loads a CSV file into a workbook with the specified options.

Declaration
public static Workbook Load(string path, CsvLoadOptions options)
Parameters
Type Name Description
string path

The path of the CSV file to open.

CsvLoadOptions options

CSV load options, or null for defaults.

Returns
Type Description
Workbook

A loaded Workbook instance.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Load(string, HtmlLoadOptions)

Loads an HTML file into a workbook with the specified options.

Declaration
public static Workbook Load(string path, HtmlLoadOptions options)
Parameters
Type Name Description
string path

The path of the HTML file to open.

HtmlLoadOptions options

HTML load options.

Returns
Type Description
Workbook

A loaded Workbook instance.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Load(string, XlsxLoadOptions)

Loads a workbook from disk by inferring format from file extension and applying XLSX load options.

Declaration
public static Workbook Load(string path, XlsxLoadOptions options)
Parameters
Type Name Description
string path
XlsxLoadOptions options
Returns
Type Description
Workbook
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Load(string, string)

Loads a password-protected workbook from disk by inferring format from file extension.

Declaration
public static Workbook Load(string path, string password)
Parameters
Type Name Description
string path
string password
Returns
Type Description
Workbook
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Load(string, CancellationToken)

Loads a workbook from disk, stopping immediately if cancellationToken is cancelled.

Declaration
public static Workbook Load(string path, CancellationToken cancellationToken)
Parameters
Type Name Description
string path
CancellationToken cancellationToken
Returns
Type Description
Workbook
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

MergeFrom(IEnumerable<Workbook>, MergeOptions)

Copies all (or selected) worksheets from each source workbook into this workbook. Source workbooks are not modified.

Declaration
public MergeResult MergeFrom(IEnumerable<Workbook> sources, MergeOptions options = null)
Parameters
Type Name Description
IEnumerable<Workbook> sources

The source workbooks to copy worksheets from.

MergeOptions options

Merge options, or null for defaults.

Returns
Type Description
MergeResult

A MergeResult describing the copied, skipped, and replaced sheets.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

RemoveDigitalSignatures(string)

Removes all digital signatures from an existing unencrypted XLSX package.

Declaration
public static void RemoveDigitalSignatures(string path)
Parameters
Type Name Description
string path
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

ReplaceAll(ReplaceArguments)

Replaces all cells matching the specified arguments.

Declaration
public void ReplaceAll(ReplaceArguments arguments)
Parameters
Type Name Description
ReplaceArguments arguments

The replace arguments.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Save(Stream)

Writes data from the Workbook.

Declaration
public void Save(Stream stream)
Parameters
Type Name Description
Stream stream

The stream used by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Save(Stream, CancellationToken)

Saves the workbook to a stream as XLSX, stopping immediately if cancellationToken is cancelled.

Declaration
public void Save(Stream stream, CancellationToken cancellationToken)
Parameters
Type Name Description
Stream stream
CancellationToken cancellationToken
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string)

Saves the workbook as the specified filename figuring out the format from the extension.

Declaration
public void SaveAs(string fileName)
Parameters
Type Name Description
string fileName
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string, CsvSaveOptions)

Saves the workbook to disk as CSV with the specified options.

Declaration
public void SaveAs(string fileName, CsvSaveOptions options)
Parameters
Type Name Description
string fileName

The output file path.

CsvSaveOptions options

CSV save options, or null for defaults.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string, FormatType)

Writes as from the Workbook.

Declaration
public void SaveAs(string fileName, FormatType saveAsFormat)
Parameters
Type Name Description
string fileName

The file name used by the operation.

FormatType saveAsFormat

The save as format used by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string, FormatType, XlsxSaveOptions)

Saves the workbook to disk using explicit format and XLSX security options.

Declaration
public void SaveAs(string fileName, FormatType saveAsFormat, XlsxSaveOptions options)
Parameters
Type Name Description
string fileName
FormatType saveAsFormat
XlsxSaveOptions options
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string, FormatType, CancellationToken)

Saves the workbook to disk in the specified format, stopping immediately if cancellationToken is cancelled.

Declaration
public void SaveAs(string fileName, FormatType saveAsFormat, CancellationToken cancellationToken)
Parameters
Type Name Description
string fileName
FormatType saveAsFormat
CancellationToken cancellationToken
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string, HtmlSaveOptions)

Saves the workbook to disk as HTML with the specified options.

Declaration
public void SaveAs(string fileName, HtmlSaveOptions options)
Parameters
Type Name Description
string fileName
HtmlSaveOptions options
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string, XlsxSaveOptions)

Saves the workbook to disk using XLSX security options.

Declaration
public void SaveAs(string fileName, XlsxSaveOptions options)
Parameters
Type Name Description
string fileName
XlsxSaveOptions options
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAs(string, CancellationToken)

Saves the workbook to disk as XLSX, stopping immediately if cancellationToken is cancelled.

Declaration
public void SaveAs(string fileName, CancellationToken cancellationToken)
Parameters
Type Name Description
string fileName
CancellationToken cancellationToken
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAsSigned(string, XlsxDigitalSignatureSaveOptions)

Saves the workbook and applies a single digital signature.

Declaration
public void SaveAsSigned(string fileName, XlsxDigitalSignatureSaveOptions signature)
Parameters
Type Name Description
string fileName
XlsxDigitalSignatureSaveOptions signature
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

SaveAsSigned(string, IEnumerable<XlsxDigitalSignatureSaveOptions>)

Saves the workbook and applies multiple digital signatures.

Declaration
public void SaveAsSigned(string fileName, IEnumerable<XlsxDigitalSignatureSaveOptions> signatures)
Parameters
Type Name Description
string fileName
IEnumerable<XlsxDigitalSignatureSaveOptions> signatures
Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Split(SplitOptions)

Creates one new workbook per worksheet in this workbook. Each result contains exactly one worksheet. This workbook is not modified.

Declaration
public IList<Workbook> Split(SplitOptions options = null)
Parameters
Type Name Description
SplitOptions options

Split options, or null for defaults.

Returns
Type Description
IList<Workbook>

A list of new workbooks, one per worksheet, in sheet order.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Events

ThemeChanged

Exposes the event handler associated with Workbook.

Declaration
public event EventHandler ThemeChanged
Event Type
Type Description
EventHandler

The event handler returned by the operation.

Remarks

A Workbook is the top-level container in the DRIT.Spreadsheet object model. It manages collections of sheets, defined names, custom properties, and workbook-level settings.

The workbook provides methods for loading from and saving to various file formats including XLSX, XLS, CSV, and ODS.

Implements

IDisposable

Extension Methods

WorkbookImageExporter.RenderSheetToImages(Workbook, int, WorkbookImageSaveOptions?)
WorkbookImageExporter.RenderToImages(Workbook, WorkbookImageSaveOptions?)
WorkbookImageExporter.RenderToImages(Workbook, CancellationToken)
WorkbookImageExporter.SaveAsImage(Workbook, string, WorkbookImageSaveOptions?)
WorkbookImageExporter.SaveAsImage(Workbook, string, CancellationToken)
WorkbookPdfExporter.BuildPdfDocument(Workbook, WorkbookPdfSaveOptions)
WorkbookPdfExporter.SaveAsEncryptedPdf(Workbook, Stream, PasswordEncryption, WorkbookPdfSaveOptions)
WorkbookPdfExporter.SaveAsEncryptedPdf(Workbook, string, PasswordEncryption, WorkbookPdfSaveOptions)
WorkbookPdfExporter.SaveAsPdf(Workbook, Stream, WorkbookPdfSaveOptions)
WorkbookPdfExporter.SaveAsPdf(Workbook, Stream, CancellationToken)
WorkbookPdfExporter.SaveAsPdf(Workbook, string, WorkbookPdfSaveOptions)
WorkbookPdfExporter.SaveAsPdf(Workbook, string, CancellationToken)
WorkbookPdfExporter.SaveAsSignedPdf(Workbook, Stream, Signer, WorkbookPdfSaveOptions, string)
WorkbookPdfExporter.SaveAsSignedPdf(Workbook, string, Signer, WorkbookPdfSaveOptions, string)
WorkbookMediaExtensions.GetEmbeddedImage(Workbook, string)
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX