Show / Hide Table of Contents

Class Workbook

Represents a spreadsheet workbook. A workbook is a container of sheets.

Inheritance
System.Object
Workbook
Implements
IDisposable
Namespace: DRIT.Spreadsheet
Assembly: DRIT.Spreadsheet.dll
Syntax
public class Workbook : object, IWorkbook, IDisposable

Constructors

Workbook()

Declaration
public Workbook()

Workbook(WorkbookCreationArguments)

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

Workbook(String)

Declaration
public Workbook(string path)
Parameters
Type Name Description
System.String path

Workbook(String, FormatType)

Declaration
public Workbook(string path, FormatType formatType)
Parameters
Type Name Description
System.String path
FormatType formatType

Fields

Views

Get or set the workbook view

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

Properties

ActiveView

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

BuiltInStyles

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

CalculationProperties

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

CellStyles

Gets all the cell styles in the workbook.

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

Connections

Get or set the data connections

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

CustomWorkbookViews

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

DefaultThemeFont

Declaration
public string DefaultThemeFont { get; }
Property Value
Type Description
System.String

DefinedNames

Get the collection of defined names in the workbook

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

DocumentProperties

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

FileName

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

FilePath

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

Declaration
public string FilePath { get; }
Property Value
Type Description
System.String

FileVersion

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

Format

Gets the format

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

Language

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

LoadErrors

Gets the list of errors.

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

Name

Get the name of the workbook

Declaration
public string Name { get; }
Property Value
Type Description
System.String

Properties

Get or set the workbook properties

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

Protection

Get or set the workbook protection

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

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

StyleSheet

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

TableDefinedNames

Get the collection of defined names in the workbook

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

Theme

Get or set the theme of the workbook

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

VbaProject

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

WebPublishing

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

Worksheets

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

Methods

AddChartsheet()

Declaration
public Chartsheet AddChartsheet()
Returns
Type Description
Chartsheet

AddChartsheet(String)

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

Declaration
public Chartsheet AddChartsheet(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
Chartsheet

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

AddWorksheet(String)

Declaration
public Worksheet AddWorksheet(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
Worksheet

Calculate()

Calculate all the worksheets in the workbook

Declaration
public void Calculate()

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

Dispose()

Declaration
public void Dispose()

FindAll(FindArguments)

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

GetSheet(String)

Declaration
public Sheet GetSheet(string name)
Parameters
Type Name Description
System.String name
Returns
Type Description
Sheet

GetWorksheet(String)

Returns the sheet with a given name.

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

The name of the sheet. This is case insensitive

Returns
Type Description
Worksheet

The sheet

ReplaceAll(ReplaceArguments)

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

Save(Stream)

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

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
System.String fileName

SaveAs(String, FormatType)

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

Events

ThemeChanged

Declaration
public event EventHandler ThemeChanged
Event Type
Type Description
EventHandler

Implements

IDisposable
Back to top Generated by DocFX