|
NanoXLSX.Core 3.0.0-rc.3
|
Class representing a workbook. More...
Public Member Functions | |
| Workbook () | |
| Default constructor. No initial worksheet is created. Use AddWorksheet(string) (or overloads) to add one. | |
| Workbook (bool createWorkSheet) | |
| Constructor with additional parameter to create a default worksheet. This constructor can be used to define a workbook that is saved as stream. | |
| Workbook (string sheetName) | |
| Constructor with additional parameter to create a default worksheet with the specified name. This constructor can be used to define a workbook that is saved as stream. | |
| Workbook (string filename, string sheetName) | |
| Constructor with filename ant the name of the first worksheet. | |
| Workbook (string filename, string sheetName, bool sanitizeSheetName) | |
| Constructor with filename ant the name of the first worksheet. | |
| void | AddMruColor (string color) |
| Adds a color value (HEX; 6-digit RGB or 8-digit ARGB) to the MRU list. | |
| IReadOnlyList< string > | GetMruColors () |
| Gets the MRU color list. | |
| void | ClearMruColors () |
| Clears the MRU color list. | |
| void | AddWorksheet (string name) |
| Adding a new Worksheet. The new worksheet will be defined as current worksheet. | |
| void | AddWorksheet (string name, bool sanitizeSheetName) |
| Adding a new Worksheet with a sanitizing option. The new worksheet will be defined as current worksheet. | |
| void | AddWorksheet (Worksheet worksheet) |
| Adding a new Worksheet. The new worksheet will be defined as current worksheet. | |
| void | AddWorksheet (Worksheet worksheet, bool sanitizeSheetName) |
| Adding a new Worksheet. The new worksheet will be defined as current worksheet. | |
| void | RemoveWorksheet (string name) |
| Removes the defined worksheet based on its name. If the worksheet is the current or selected worksheet, the current and / or the selected worksheet will be set to the last worksheet of the workbook. If the last worksheet is removed, the selected worksheet will be set to 0 and the current worksheet to null. | |
| void | RemoveWorksheet (int index) |
| Removes the defined worksheet based on its index. If the worksheet is the current or selected worksheet, the current and / or the selected worksheet will be set to the last worksheet of the workbook. If the last worksheet is removed, the selected worksheet will be set to 0 and the current worksheet to null. | |
| Worksheet | SetCurrentWorksheet (string name) |
| Sets the current worksheet. | |
| Worksheet | SetCurrentWorksheet (int worksheetIndex) |
| Sets the current worksheet. | |
| void | SetCurrentWorksheet (Worksheet worksheet) |
| Sets the current worksheet. | |
| void | SetSelectedWorksheet (string name) |
| Sets the selected worksheet in the output workbook. | |
| void | SetSelectedWorksheet (int worksheetIndex) |
| Sets the selected worksheet in the output workbook. | |
| void | SetSelectedWorksheet (Worksheet worksheet) |
| Sets the selected worksheet in the output workbook. | |
| Worksheet | GetWorksheet (string name) |
| Gets a worksheet from this workbook by name. | |
| Worksheet | GetWorksheet (int index) |
| Gets a worksheet from this workbook by index. | |
| void | SetWorkbookProtection (bool state, bool protectWindows, bool protectStructure, string password) |
| Sets or removes the workbook protection. If protectWindows and protectStructure are both false, the workbook will not be protected. | |
| Worksheet | CopyWorksheetIntoThis (string sourceWorksheetName, string newWorksheetName, bool sanitizeSheetName=true) |
| Copies a worksheet of the current workbook by its name. | |
| Worksheet | CopyWorksheetIntoThis (int sourceWorksheetIndex, string newWorksheetName, bool sanitizeSheetName=true) |
| Copies a worksheet of the current workbook by its index. | |
| Worksheet | CopyWorksheetIntoThis (Worksheet sourceWorksheet, string newWorksheetName, bool sanitizeSheetName=true) |
| Copies a worksheet of any workbook into the current workbook. | |
| Worksheet | CopyWorksheetTo (string sourceWorksheetName, string newWorksheetName, Workbook targetWorkbook, bool sanitizeSheetName=true) |
| Copies a worksheet of the current workbook by its name into another workbook. | |
| Worksheet | CopyWorksheetTo (int sourceWorksheetIndex, string newWorksheetName, Workbook targetWorkbook, bool sanitizeSheetName=true) |
| Copies a worksheet of the current workbook by its index into another workbook. | |
Static Public Member Functions | |
| static Worksheet | CopyWorksheetTo (Worksheet sourceWorksheet, string newWorksheetName, Workbook targetWorkbook, bool sanitizeSheetName=true) |
| Copies a worksheet of any workbook into the another workbook. | |
Properties | |
| Shortener | WS [get] |
| Gets the shortener object for the current worksheet. | |
| Worksheet | CurrentWorksheet [get] |
| Gets the current worksheet. | |
| string | Filename [get, set] |
| Gets or sets the filename of the workbook. | |
| bool | LockStructureIfProtected [get] |
| Gets whether the structure are locked if workbook is protected. See also SetWorkbookProtection. | |
| bool | LockWindowsIfProtected [get] |
| Gets whether the windows are locked if workbook is protected. See also SetWorkbookProtection. | |
| Metadata | WorkbookMetadata [get, set] |
| Meta data object of the workbook. | |
| int | SelectedWorksheet [get] |
| Gets the selected worksheet. The selected worksheet is not the current worksheet while design time but the selected sheet in the output file. | |
| bool | UseWorkbookProtection [get, set] |
| Gets or sets whether the workbook is protected. | |
| virtual IPassword | WorkbookProtectionPassword [get, set] |
| Password instance of the protected workbook. If a password was set, the pain text representation and the hash can be read from the instance. | |
| List< Worksheet > | Worksheets [get] |
| Gets the list of worksheets in the workbook. | |
| bool | Hidden [get, set] |
| Gets or sets whether the whole workbook is hidden. | |
| Theme | WorkbookTheme = Theme.GetDefaultTheme() [get, set] |
| Gets or sets the theme of the workbook. The default is defined by Theme.GetDefaultTheme. However, the theme can be nullified. | |
Class representing a workbook.
Definition at line 22 of file Workbook.cs.
| NanoXLSX.Workbook.Workbook | ( | ) |
Default constructor. No initial worksheet is created. Use AddWorksheet(string) (or overloads) to add one.
Definition at line 152 of file Workbook.cs.
| NanoXLSX.Workbook.Workbook | ( | bool | createWorkSheet | ) |
Constructor with additional parameter to create a default worksheet. This constructor can be used to define a workbook that is saved as stream.
| createWorkSheet | If true, a default worksheet with the name 'Sheet1' will be crated and set as current worksheet |
Definition at line 161 of file Workbook.cs.
| NanoXLSX.Workbook.Workbook | ( | string | sheetName | ) |
Constructor with additional parameter to create a default worksheet with the specified name. This constructor can be used to define a workbook that is saved as stream.
| sheetName | Filename of the workbook. The name will be sanitized automatically according to the specifications of Excel |
Definition at line 174 of file Workbook.cs.
| NanoXLSX.Workbook.Workbook | ( | string | filename, |
| string | sheetName ) |
Constructor with filename ant the name of the first worksheet.
| filename | Filename of the workbook. The name will be sanitized automatically according to the specifications of Excel |
| sheetName | Name of the first worksheet. The name will be sanitized automatically according to the specifications of Excel |
Definition at line 185 of file Workbook.cs.
| NanoXLSX.Workbook.Workbook | ( | string | filename, |
| string | sheetName, | ||
| bool | sanitizeSheetName ) |
Constructor with filename ant the name of the first worksheet.
| filename | Filename of the workbook |
| sheetName | Name of the first worksheet |
| sanitizeSheetName | If true, the name of the worksheet will be sanitized automatically according to the specifications of Excel |
Definition at line 198 of file Workbook.cs.
| void NanoXLSX.Workbook.AddMruColor | ( | string | color | ) |
Adds a color value (HEX; 6-digit RGB or 8-digit ARGB) to the MRU list.
| color | RGB code in hex format (either 6 characters, e.g. FF00AC or 8 characters with leading alpha value). Alpha will be set to full opacity (FF) in case of 6 characters |
Definition at line 220 of file Workbook.cs.
| void NanoXLSX.Workbook.AddWorksheet | ( | string | name | ) |
Adding a new Worksheet. The new worksheet will be defined as current worksheet.
| name | Name of the new worksheet |
| WorksheetException | Throws a WorksheetException if the name of the worksheet already exists |
| NanoXLSX.Exceptions.FormatException | Throws a FormatException if the name contains illegal characters or is out of range (length between 1 an 31 characters) |
Definition at line 253 of file Workbook.cs.
| void NanoXLSX.Workbook.AddWorksheet | ( | string | name, |
| bool | sanitizeSheetName ) |
Adding a new Worksheet with a sanitizing option. The new worksheet will be defined as current worksheet.
| name | Name of the new worksheet |
| sanitizeSheetName | If true, the name of the worksheet will be sanitized automatically according to the specifications of Excel |
| WorksheetException | WorksheetException is thrown if the name of the worksheet already exists and sanitizeSheetName is false |
| NanoXLSX.Exceptions.FormatException | FormatException is thrown if the worksheet name contains illegal characters or is out of range (length between 1 an 31) and sanitizeSheetName is false |
Definition at line 276 of file Workbook.cs.
| void NanoXLSX.Workbook.AddWorksheet | ( | Worksheet | worksheet | ) |
Adding a new Worksheet. The new worksheet will be defined as current worksheet.
| worksheet | Prepared worksheet object |
| WorksheetException | WorksheetException is thrown if the name of the worksheet already exists |
| NanoXLSX.Exceptions.FormatException | FormatException is thrown if the worksheet name contains illegal characters or is out of range (length between 1 an 31) |
Definition at line 295 of file Workbook.cs.
| void NanoXLSX.Workbook.AddWorksheet | ( | Worksheet | worksheet, |
| bool | sanitizeSheetName ) |
Adding a new Worksheet. The new worksheet will be defined as current worksheet.
| worksheet | Prepared worksheet object |
| sanitizeSheetName | If true, the name of the worksheet will be sanitized automatically according to the specifications of Excel |
| WorksheetException | WorksheetException is thrown if the name of the worksheet already exists, when sanitation is false |
| NanoXLSX.Exceptions.FormatException | FormatException is thrown if the worksheet name contains illegal characters or is out of range (length between 1 an 31) and sanitation is false |
Definition at line 307 of file Workbook.cs.
| void NanoXLSX.Workbook.ClearMruColors | ( | ) |
Clears the MRU color list.
Definition at line 242 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.CopyWorksheetIntoThis | ( | int | sourceWorksheetIndex, |
| string | newWorksheetName, | ||
| bool | sanitizeSheetName = true ) |
Copies a worksheet of the current workbook by its index.
| sourceWorksheetIndex | Index of the worksheet to copy, originated in this workbook |
| newWorksheetName | Name of the new worksheet (copy) |
| sanitizeSheetName | If true, the new name will be automatically sanitized if a name collision occurs |
Definition at line 547 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.CopyWorksheetIntoThis | ( | string | sourceWorksheetName, |
| string | newWorksheetName, | ||
| bool | sanitizeSheetName = true ) |
Copies a worksheet of the current workbook by its name.
| sourceWorksheetName | Name of the worksheet to copy, originated in this workbook |
| newWorksheetName | Name of the new worksheet (copy) |
| sanitizeSheetName | If true, the new name will be automatically sanitized if a name collision occurs |
Definition at line 533 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.CopyWorksheetIntoThis | ( | Worksheet | sourceWorksheet, |
| string | newWorksheetName, | ||
| bool | sanitizeSheetName = true ) |
Copies a worksheet of any workbook into the current workbook.
| sourceWorksheet | Worksheet to copy |
| newWorksheetName | Name of the new worksheet (copy) |
| sanitizeSheetName | If true, the new name will be automatically sanitized if a name collision occurs |
Definition at line 561 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.CopyWorksheetTo | ( | int | sourceWorksheetIndex, |
| string | newWorksheetName, | ||
| Workbook | targetWorkbook, | ||
| bool | sanitizeSheetName = true ) |
Copies a worksheet of the current workbook by its index into another workbook.
| sourceWorksheetIndex | Index of the worksheet to copy, originated in this workbook |
| newWorksheetName | Name of the new worksheet (copy) |
| targetWorkbook | Workbook to copy the worksheet into |
| sanitizeSheetName | If true, the new name will be automatically sanitized if a name collision occurs |
Definition at line 590 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.CopyWorksheetTo | ( | string | sourceWorksheetName, |
| string | newWorksheetName, | ||
| Workbook | targetWorkbook, | ||
| bool | sanitizeSheetName = true ) |
Copies a worksheet of the current workbook by its name into another workbook.
| sourceWorksheetName | Name of the worksheet to copy, originated in this workbook |
| newWorksheetName | Name of the new worksheet (copy) |
| targetWorkbook | Workbook to copy the worksheet into |
| sanitizeSheetName | If true, the new name will be automatically sanitized if a name collision occurs |
Definition at line 575 of file Workbook.cs.
|
static |
Copies a worksheet of any workbook into the another workbook.
| sourceWorksheet | Worksheet to copy |
| newWorksheetName | Name of the new worksheet (copy) |
| targetWorkbook | Workbook to copy the worksheet into |
| sanitizeSheetName | If true, the new name will be automatically sanitized if a name collision occurs |
Definition at line 606 of file Workbook.cs.
| IReadOnlyList< string > NanoXLSX.Workbook.GetMruColors | ( | ) |
Gets the MRU color list.
Definition at line 234 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.GetWorksheet | ( | int | index | ) |
Gets a worksheet from this workbook by index.
| index | Index of the worksheet |
| WorksheetException | Throws a RangeException if the worksheet was not found in the worksheet collection |
Definition at line 494 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.GetWorksheet | ( | string | name | ) |
Gets a worksheet from this workbook by name.
| name | Name of the worksheet |
| WorksheetException | Throws a WorksheetException if the worksheet was not found in the worksheet collection |
Definition at line 478 of file Workbook.cs.
| void NanoXLSX.Workbook.RemoveWorksheet | ( | int | index | ) |
Removes the defined worksheet based on its index. If the worksheet is the current or selected worksheet, the current and / or the selected worksheet will be set to the last worksheet of the workbook. If the last worksheet is removed, the selected worksheet will be set to 0 and the current worksheet to null.
| index | Index within the worksheets list |
| WorksheetException | Throws a WorksheetException if the index is out of range |
Definition at line 359 of file Workbook.cs.
| void NanoXLSX.Workbook.RemoveWorksheet | ( | string | name | ) |
Removes the defined worksheet based on its name. If the worksheet is the current or selected worksheet, the current and / or the selected worksheet will be set to the last worksheet of the workbook. If the last worksheet is removed, the selected worksheet will be set to 0 and the current worksheet to null.
| name | Name of the worksheet |
| WorksheetException | Throws a WorksheetException if the name of the worksheet is unknown |
Definition at line 340 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.SetCurrentWorksheet | ( | int | worksheetIndex | ) |
Sets the current worksheet.
| worksheetIndex | Zero-based worksheet index |
| WorksheetException | Throws a WorksheetException if the name of the worksheet is unknown |
Definition at line 401 of file Workbook.cs.
| Worksheet NanoXLSX.Workbook.SetCurrentWorksheet | ( | string | name | ) |
Sets the current worksheet.
| name | Name of the worksheet |
| WorksheetException | Throws a WorksheetException if the name of the worksheet is unknown |
Definition at line 388 of file Workbook.cs.
| void NanoXLSX.Workbook.SetCurrentWorksheet | ( | Worksheet | worksheet | ) |
Sets the current worksheet.
| worksheet | Worksheet object (must be in the collection of worksheets) |
| WorksheetException | Throws a WorksheetException if the worksheet was not found in the worksheet collection |
Definition at line 413 of file Workbook.cs.
| void NanoXLSX.Workbook.SetSelectedWorksheet | ( | int | worksheetIndex | ) |
Sets the selected worksheet in the output workbook.
| worksheetIndex | Zero-based worksheet index |
| RangeException | Throws a RangeException if the index of the worksheet is out of range |
| WorksheetException | Throws a WorksheetException if the worksheet to be set selected is hidden |
Definition at line 446 of file Workbook.cs.
| void NanoXLSX.Workbook.SetSelectedWorksheet | ( | string | name | ) |
Sets the selected worksheet in the output workbook.
| name | Name of the worksheet |
| WorksheetException | Throws a WorksheetException if the name of the worksheet is unknown |
Definition at line 429 of file Workbook.cs.
| void NanoXLSX.Workbook.SetSelectedWorksheet | ( | Worksheet | worksheet | ) |
Sets the selected worksheet in the output workbook.
| worksheet | Worksheet object (must be in the collection of worksheets) |
| WorksheetException | Throws a WorksheetException if the worksheet was not found in the worksheet collection or if it is hidden |
Definition at line 462 of file Workbook.cs.
| void NanoXLSX.Workbook.SetWorkbookProtection | ( | bool | state, |
| bool | protectWindows, | ||
| bool | protectStructure, | ||
| string | password ) |
Sets or removes the workbook protection. If protectWindows and protectStructure are both false, the workbook will not be protected.
| state | If true, the workbook will be protected, otherwise not |
| protectWindows | If true, the windows will be locked if the workbook is protected |
| protectStructure | If true, the structure will be locked if the workbook is protected |
| password | Optional password. If null or empty, no password will be set in case of protection |
Definition at line 510 of file Workbook.cs.
|
get |
Gets the current worksheet.
Definition at line 63 of file Workbook.cs.
|
getset |
Gets or sets the filename of the workbook.
Definition at line 74 of file Workbook.cs.
|
getset |
Gets or sets whether the whole workbook is hidden.
Definition at line 138 of file Workbook.cs.
|
get |
Gets whether the structure are locked if workbook is protected. See also SetWorkbookProtection.
Definition at line 83 of file Workbook.cs.
|
get |
Gets whether the windows are locked if workbook is protected. See also SetWorkbookProtection.
Definition at line 91 of file Workbook.cs.
|
get |
Gets the selected worksheet. The selected worksheet is not the current worksheet while design time but the selected sheet in the output file.
Definition at line 108 of file Workbook.cs.
|
getset |
Gets or sets whether the workbook is protected.
Definition at line 116 of file Workbook.cs.
|
getset |
Meta data object of the workbook.
Definition at line 99 of file Workbook.cs.
|
getset |
Password instance of the protected workbook. If a password was set, the pain text representation and the hash can be read from the instance.
Definition at line 123 of file Workbook.cs.
|
getset |
Gets or sets the theme of the workbook. The default is defined by Theme.GetDefaultTheme. However, the theme can be nullified.
Definition at line 143 of file Workbook.cs.
|
get |
Gets the list of worksheets in the workbook.
Definition at line 128 of file Workbook.cs.
|
get |
Gets the shortener object for the current worksheet.
Definition at line 54 of file Workbook.cs.