Class Workbook
Represents a spreadsheet workbook. A workbook is a container of sheets.
Inheritance
System.Object
Workbook
Assembly: DRIT.Spreadsheet.dll
Syntax
public class Workbook : object, IWorkbook, IDisposable
Constructors
Workbook()
Declaration
Workbook(WorkbookCreationArguments)
Declaration
public Workbook(WorkbookCreationArguments arguments)
Parameters
Workbook(String)
Declaration
public Workbook(string path)
Parameters
Type |
Name |
Description |
System.String |
path |
|
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
Properties
ActiveView
Declaration
public WorkbookView ActiveView { get; }
Property Value
BuiltInStyles
Declaration
public IEnumerable<StyleSheetCellStyle> BuiltInStyles { get; }
Property Value
CalculationProperties
Declaration
public CalculationProperties CalculationProperties { get; set; }
Property Value
CellStyles
Gets all the cell styles in the workbook.
Declaration
public IEnumerable<StyleSheetCellStyle> CellStyles { get; }
Property Value
Connections
Get or set the data connections
Declaration
public List<DataConnection> Connections { get; set; }
Property Value
CustomWorkbookViews
Declaration
public List<CustomWorkbookView> CustomWorkbookViews { get; }
Property Value
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
DocumentProperties
Declaration
public DocumentProperties DocumentProperties { get; }
Property Value
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
Declaration
public FormatType Format { get; }
Property Value
Language
Declaration
public string Language { get; set; }
Property Value
Type |
Description |
System.String |
|
LoadErrors
Declaration
public IReadOnlyList<LoadError> LoadErrors { get; }
Property Value
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
Protection
Get or set the workbook protection
Declaration
public WorkbookProtection Protection { get; }
Property Value
Sheets
Get the collection of sheets in the workbook. In most cases, sheet are worksheets.
Declaration
public SheetCollection Sheets { get; }
Property Value
StyleSheet
Declaration
public Styles StyleSheet { get; }
Property Value
TableDefinedNames
Get the collection of defined names in the workbook
Declaration
public ObservableCollection<TableDefinedName> TableDefinedNames { get; }
Property Value
Theme
Get or set the theme of the workbook
Declaration
public Theme Theme { get; }
Property Value
VbaProject
Declaration
public Project VbaProject { get; }
Property Value
WebPublishing
Declaration
public WebPublishing WebPublishing { get; set; }
Property Value
Worksheets
Declaration
public WorksheetCollection Worksheets { get; }
Property Value
Methods
AddChartsheet()
Declaration
public Chartsheet AddChartsheet()
Returns
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
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
Calculate()
Calculate all the worksheets in the workbook
Declaration
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
FindAll(FindArguments)
Declaration
public IEnumerable<Cell> FindAll(FindArguments arguments)
Parameters
Returns
Type |
Description |
IEnumerable<Cell> |
|
GetSheet(String)
Declaration
public Sheet GetSheet(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
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
ReplaceAll(ReplaceArguments)
Declaration
public void ReplaceAll(ReplaceArguments arguments)
Parameters
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 |
|
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