Class WorkBook
Class that stands for a whole Excel file. This is the first object most users will construct whether they are reading or writing a workbook. It is also the top level (home-base) object for creating new sheets and most other Excel programming operations.
Inheritance
Namespace: IronXL
Assembly: IronXL.dll
Syntax
public class WorkBook : Object
Constructors
WorkBook(ExcelFileFormat)
Initializes a new instance of the WorkBook class as a new empty spreadsheet in XLS or XLSX format.
Declaration
public WorkBook(ExcelFileFormat fileFormat)
Parameters
Type | Name | Description |
---|---|---|
ExcelFileFormat | fileFormat | The excel file format. XLS (legacy) or XLSX (preferred). |
See Also
WorkBook(Byte[])
Loads a new instance of the WorkBook by loading a CSV, TSV, XLS or XLSX from a Byte Array (byte[]).
Declaration
public WorkBook(byte[] spreadSheetBytes)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | spreadSheetBytes | The spread sheet data to load into IronXL. |
WorkBook(Stream)
Loads a new instance of the WorkBook by loading a CSV, TSV, XLS or XLSX from a System.IO.Stream.
Declaration
public WorkBook(Stream spreadSheetStream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | spreadSheetStream | The spread sheet stream to load into IronXL. |
WorkBook(String)
Loads a new instance of the WorkBook by loading a CSV, TSV, XLS or XLSX file.
Declaration
public WorkBook(string spreadSheetFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | spreadSheetFilePath | The spread sheet file path to load into IronXL. |
Properties
DefaultWorkSheet
Gets the default (first) work sheet in the workbook.
Declaration
public WorkSheet DefaultWorkSheet { get; }
Property Value
Type | Description |
---|---|
WorkSheet | The default work sheet or |
FilePath
The full file path to this Excel or CSV document.
returns null if this WorkBook has no location on disk. Use SaveAs(String) to set a path.
Declaration
public string FilePath { get; }
Property Value
Type | Description |
---|---|
System.String | A fully qualified file path; |
IsEncrypted
Checks if workbook should be encrypted when saved
Declaration
public bool IsEncrypted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Metadata
Gets the metadata of the document.
Declaration
public IMetadata Metadata { get; }
Property Value
Type | Description |
---|---|
IMetadata |
Password
Password with which the workbook will be encrypted when saved. Workbook will not be encrypted if this property is null;
Declaration
public string Password { get; set; }
Property Value
Type | Description |
---|---|
System.String |
WorkSheets
Collection of worksheets within current workbook
Declaration
public WorksheetsCollection WorkSheets { get; }
Property Value
Type | Description |
---|---|
WorksheetsCollection | The work sheets as a list. Can be accessed as WorkBook.WorkSheets[0]. |
Methods
Close()
Closes the workbook object.
Once this has been called, no further operations, updates or reads should be performed on the Workbook.
Declaration
public void Close()
Create()
Create new XLSX Excel WorkBook.
Declaration
public static WorkBook Create()
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Create(ExcelFileFormat)
Create new workbook with the specified format.
Declaration
public static WorkBook Create(ExcelFileFormat fileFormat)
Parameters
Type | Name | Description |
---|---|---|
ExcelFileFormat | fileFormat | The excel file format. XLSX or XLS |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Create(CreatingOptions)
Create new workbook with the specified options.
Declaration
public static WorkBook Create(CreatingOptions options)
Parameters
Type | Name | Description |
---|---|---|
CreatingOptions | options | Advanced workbook creation options object. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Exceptions
Type | Condition |
---|---|
System.Exception |
CreateWorkSheet(String)
Create new worksheet with the specified name
Declaration
public WorkSheet CreateWorkSheet(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the new worksheet. |
Returns
Type | Description |
---|---|
WorkSheet |
Decrypt(Stream, String)
Decrypts a stream using provided password
Declaration
public static MemoryStream Decrypt(Stream stream, string password)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A stream to decrypt |
System.String | password | A password |
Returns
Type | Description |
---|---|
System.IO.MemoryStream | Decrypted System.IO.MemoryStream |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException |
Encrypt(String)
Encrypts a workbook with a password provided as argument or
- if password is not provided - with a password stored in Password property.
Declaration
public MemoryStream Encrypt(string password = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | password | Password to use for encryption |
Returns
Type | Description |
---|---|
System.IO.MemoryStream | Encryped System.IO.MemoryStream |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if no password provided as argument and no password is stored in Password property |
EvaluateAll()
Loops over all cells in all sheets of the associated workbook. For cells that contain formulas, their formulas are evaluated, and the results are saved. These cells remain as formula cells. For cells that do not contain formulas, no changes are made.
Declaration
public WorkBook EvaluateAll()
Returns
Type | Description |
---|---|
WorkBook |
ExportToHtml(String)
Export workbook to the HTML file with the specified name.
Declaration
public WorkBook ExportToHtml(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The filename |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
ExportToHtml(String, HtmlExportOptions)
Export workbook to the HTML file with the specified name.
Declaration
public WorkBook ExportToHtml(string filename, HtmlExportOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | Filename to save with |
HtmlExportOptions | options | Options to customize result file view. |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
ExportToHtml(String, Boolean, Boolean, Boolean, Boolean, Boolean)
Exports workbook to the HTML file with the specified name and HTMLExportOptions.
Declaration
public WorkBook ExportToHtml(string filename, bool outputColumnHeaders = true, bool outputHiddenColumns = false, bool outputHiddenRows = true, bool outputLeadingSpacesAsNonBreaking = true, bool outputRowNumbers = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The filename. |
System.Boolean | outputColumnHeaders | Property that indicates whether to show column header in result file. |
System.Boolean | outputHiddenColumns | Property that indicates whether to show hidden columns in result file.. |
System.Boolean | outputHiddenRows | Property that indicates whether to show hidden rows in result file. |
System.Boolean | outputLeadingSpacesAsNonBreaking | Property that indicates whether to show leading spaces as non-breaking in result file. |
System.Boolean | outputRowNumbers | Property that indicates whether to show row numbers in result file. |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
ExportToHtmlString(HtmlExportOptions)
Export workbook to HTML file with the specified options.
Declaration
public string ExportToHtmlString(HtmlExportOptions options)
Parameters
Type | Name | Description |
---|---|---|
HtmlExportOptions | options | Options to customize result file view. |
Returns
Type | Description |
---|---|
System.String | An HTML String |
ExportToHtmlString(Boolean, Boolean, Boolean, Boolean, Boolean)
Exports workbook to HTML with the specified HTMLExportOptions.
Declaration
public string ExportToHtmlString(bool outputColumnHeaders = true, bool outputHiddenColumns = false, bool outputHiddenRows = true, bool outputLeadingSpacesAsNonBreaking = true, bool outputRowNumbers = true)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | outputColumnHeaders | Property that indicates whether to show column header in result file. |
System.Boolean | outputHiddenColumns | Property that indicates whether to show hidden columns in result file.. |
System.Boolean | outputHiddenRows | Property that indicates whether to show hidden rows in result file. |
System.Boolean | outputLeadingSpacesAsNonBreaking | Property that indicates whether to show leading spaces as non-breaking in result file. |
System.Boolean | outputRowNumbers | Property that indicates whether to show row numbers in result file. |
Returns
Type | Description |
---|---|
System.String | A formatted HTML String. |
FromByteArray(Byte[])
Creates a new workbook from its binary data in memory (byte[])
Declaration
public static WorkBook FromByteArray(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | A byte array of an XLS, XLSX or CSV file |
Returns
Type | Description |
---|---|
WorkBook | The imported spreadsheet data as a WorkBook object |
FromByteArray(Byte[], String)
Creates a new workbook from its binary data in memory (byte[]) using provided password.
Declaration
public static WorkBook FromByteArray(byte[] data, string password)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | A byte array of an XLS, XLSX or CSV file |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | The imported spreadsheet data as a WorkBook object |
FromStream(Stream)
Creates a new workbook from its a System.IO.Stream
Declaration
public static WorkBook FromStream(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A Stream of an XLS, XLSX or CSV file |
Returns
Type | Description |
---|---|
WorkBook | The imported spreadsheet stream as a WorkBook object |
FromStream(Stream, String)
Creates a new workbook from its System.IO.Stream using provided password.
Declaration
public static WorkBook FromStream(Stream stream, string password)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | A Stream of an XLS, XLSX or CSV file |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | The imported spreadsheet stream as a WorkBook object |
GetWorkSheet(String)
Returns a WorkSheet within this WorkBook; identified by its name.
Returns null
if the named worksheet would not be found.
Declaration
public WorkSheet GetWorkSheet(string workSheetName)
Parameters
Type | Name | Description |
---|---|---|
System.String | workSheetName | Name of the work sheet to select. |
Returns
Type | Description |
---|---|
WorkSheet | The specified WorkSheet. Returns |
Import(String, ExcelFileFormat)
Imports and creates a new workbook from specified CSV, TSV, JSON or XML file.
Declaration
public static WorkBook Import(string filename, ExcelFileFormat fileFormat)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to import. |
ExcelFileFormat | fileFormat | The excel file format to generate with the imported data. XLS or XLSX. XLSX is preferred and default. |
Returns
Type | Description |
---|---|
WorkBook | The loaded spreadsheet as a WorkBook. |
Load(Byte[])
Load workbook from a ByteArray (byte[]).
Shortcut synonym for LoadExcel(Byte[])
Declaration
public static WorkBook Load(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The binary data of the file to load. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Load(Byte[], String)
Load workbook from a ByteArray (byte[]) using provided password.
Shortcut synonym for LoadExcel(Byte[])
Declaration
public static WorkBook Load(byte[] data, string password)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The binary data of the file to load. |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Load(DataSet, CreatingOptions)
Load workbook from specified System.Data.DataSet
Declaration
public static WorkBook Load(DataSet dataset, CreatingOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataset | The dataset to load from. |
CreatingOptions | options | Advanced options when importing non Excel formats. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Load(Stream)
Load workbook from a System.IO.Stream.
Shortcut synonym for LoadExcel(Stream)
Declaration
public static WorkBook Load(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream of the file to load. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Load(Stream, String)
Load workbook from a System.IO.Stream using provided password.
Shortcut synonym for LoadExcel(Stream)
Declaration
public static WorkBook Load(Stream stream, string password)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | The stream of the file to load. |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Load(String)
Load workbook from specified file.
Shortcut synonym for LoadExcel(String)
Declaration
public static WorkBook Load(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
Load(String, LoadingOptions)
Load workbook from a specified file.
Supported formats are: XLS, XLSX, CSV, TSV, JSON, XML.
Declaration
public static WorkBook Load(string filename, LoadingOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
LoadingOptions | options | Advanced options when importing non Excel formats. |
Returns
Type | Description |
---|---|
WorkBook | An Excel WorkBook object. |
Exceptions
Type | Condition |
---|---|
System.Exception | A general exception with a detailed developer message. |
System.FormatException | Unsupported file extension. Supported formats are: XLS, XLSX, CSV, TSV. |
Load(String, String)
Load workbook from a specified file using provided password.
Declaration
public static WorkBook Load(string filename, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
System.String | password | Password |
Returns
Type | Description |
---|---|
WorkBook | An Excel WorkBook object. |
Load(String, String, ExcelFileFormat)
Loads workbook from specified file.
Declaration
public static WorkBook Load(string filename, string listDelimiter = null, ExcelFileFormat fileFormat)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
System.String | listDelimiter | The list delimiter. |
ExcelFileFormat | fileFormat | The file format. |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
LoadCSV(String, ExcelFileFormat, String, Boolean)
Imports and creates a new workbook from specified CSV or TSV file.
Declaration
public static WorkBook LoadCSV(string filename, ExcelFileFormat fileFormat, string listDelimiter = null, bool convertFieldValues = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to import. |
ExcelFileFormat | fileFormat | The excel file format to generate with the imported data. XLS or XLSX. XLSX is preferred and default. |
System.String | listDelimiter | The column list delimiter. Default (null) will refer to the system default settings. |
System.Boolean | convertFieldValues | Converts field values when loading CSV/TSV files.
Default value is |
Returns
Type | Description |
---|---|
WorkBook | The imported spreadsheet as a WorkBook object |
LoadExcel(Byte[])
Load workbook from specified Byte Array.
Declaration
public static WorkBook LoadExcel(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The Byte Array of the file to load. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
LoadExcel(Byte[], String)
Load workbook from specified Byte Array using provided password.
Declaration
public static WorkBook LoadExcel(byte[] data, string password)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The Byte Array of the file to load. |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
LoadExcel(Stream)
Load workbook from specified Stream.
Declaration
public static WorkBook LoadExcel(Stream file)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | file | The Stream of the file to load. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
LoadExcel(Stream, String)
Load workbook from specified Stream using provided password.
Declaration
public static WorkBook LoadExcel(Stream file, string password)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | file | The Stream of the file to load. |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
LoadExcel(String)
Load workbook from specified file.
Declaration
public static WorkBook LoadExcel(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
LoadExcel(String, String)
Load workbook from specified file using provided password.
Declaration
public static WorkBook LoadExcel(string filename, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | A new WorkBook |
LoadWorkSheet(DataTable)
Import System.Data.DataTable as a worksheet.
Useful when moving data between Excel and SQL.
Declaration
public WorkSheet LoadWorkSheet(DataTable table)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | table | The DataTable to load from. |
Returns
Type | Description |
---|---|
WorkSheet | Added WorkSheet |
LoadWorkSheetsFromDataSet(DataSet, WorkBook)
Loads tables from specified System.Data.DataSet to specified WorkBook. Each table of the System.Data.DataSet will be represented as a separate WorkSheet.
Declaration
public static void LoadWorkSheetsFromDataSet(DataSet dataset, WorkBook workBook)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataSet | dataset | The dataset to load from. |
WorkBook | workBook | WorkBook to load data to |
RemoveWorkSheet(Int32)
Remove worksheet with the specified position within workbook.
Declaration
public void RemoveWorkSheet(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Worksheet 0-based index. |
RemoveWorkSheet(String)
Remove worksheet with the specified name.
Declaration
public void RemoveWorkSheet(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Worksheet name. |
Save()
Save workbook to the File Path from where it was loaded.
Declaration
public WorkBook Save()
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
See Also
Save(SavingOptions)
Save workbook to the File Path from where it was loaded.
Declaration
public WorkBook Save(SavingOptions options)
Parameters
Type | Name | Description |
---|---|---|
SavingOptions | options | Advanced file saving options. |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
See Also
SaveAs(String)
Save workbook with the specified filename.
Supported formats are: XLS, XLSX, CSV, TSV, JSON, XML
Declaration
public WorkBook SaveAs(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | A file path to save the spreadsheet to. |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
SaveAs(String, SavingOptions)
Save workbook with the specified filename.
Supported formats are: XLS, XLSX, CSV, TSV, JSON, XML
Declaration
public WorkBook SaveAs(string fileName, SavingOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | A file path to save the spreadsheet to. |
SavingOptions | options | Advanced file saving options. |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
Exceptions
Type | Condition |
---|---|
System.FormatException | Unsupported file extension. Supported formats are: XLS, XLSX, CSV, TSV, JSON, XML |
SaveAs(String, String)
Save workbook with the specified filename and encrypt it with a specified password
Currently encryption only supported for ".xlsx", ".xlsm" and ".xltx" formats
Declaration
public WorkBook SaveAs(string fileName, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | A file path to save the spreadsheet to. |
System.String | password | Password (cannot be null) |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
SaveAsCsv(String, String)
Exports the Excel file as CSV.
Declaration
public void SaveAsCsv(string filename, string delimiter = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The CSV file path. |
System.String | delimiter | The CSV column delimiter. Leave this null to use the system default. |
SaveAsJson(String)
Exports the Excel file as JSON.
Declaration
public void SaveAsJson(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The JSON file path. |
SaveAsWithCustomDelimiter(String, String)
Save workbook with the specified filename.
Declaration
public WorkBook SaveAsWithCustomDelimiter(string fileName, string listDelimiter = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file. |
System.String | listDelimiter | The list delimiter. |
Returns
Type | Description |
---|---|
WorkBook | This WorkBook, allowing for a fluent, in-line coding style. |
SaveAsXml(String)
Exports the Excel file as XML.
Declaration
public void SaveAsXml(string filename)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The XML file path. |
SetActiveTab(Int32)
Set index (zero-based) of the active tab
Declaration
public void SetActiveTab(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | Index of the active tab. |
SetSheetPosition(String, Int32)
Set new tab zero-indexed position within workbook for the specified worksheet.
Declaration
public void SetSheetPosition(string sheetName, int index)
Parameters
Type | Name | Description |
---|---|---|
System.String | sheetName | Name of the sheet. |
System.Int32 | index | The index to insert at. |
ToBinary()
Converts workbook to a binary representation.
Declaration
public byte[] ToBinary()
Returns
Type | Description |
---|---|
System.Byte[] | A byte array of the excel file contents |
ToByteArray()
Synonym of ToBinary()
Declaration
public byte[] ToByteArray()
Returns
Type | Description |
---|---|
System.Byte[] | A byte array of the excel file contents |
ToDataSet(Boolean)
Convert workbook to System.Data.DataSet where each worksheet represents System.Data.DataTable
Declaration
public DataSet ToDataSet(bool useFirstRowAsColumnNames = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | useFirstRowAsColumnNames | if set to |
Returns
Type | Description |
---|---|
System.Data.DataSet | A System.Data.DataSet containing the entire WorkBook. |
ToStream()
Converts workbook to a memory stream.
Declaration
public MemoryStream ToStream()
Returns
Type | Description |
---|---|
System.IO.MemoryStream | A System.IO.MemoryStream of the excel file contents |
TryLoad(String, out WorkBook)
Loads the specified workbook to its WorkBook instance and returns a value that indicates whether the load succeeded.
Declaration
public static bool TryLoad(string filename, out WorkBook workBook)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
WorkBook | workBook | When this method returns, contains the WorkBook
instance loaded from the |
Returns
Type | Description |
---|---|
System.Boolean | true if workbook from the |
TryLoad(String, out WorkBook, LoadingOptions)
Loads the specified workbook to its WorkBook instance and returns a value that indicates whether the load succeeded.
Declaration
public static bool TryLoad(string filename, out WorkBook workBook, LoadingOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
WorkBook | workBook | When this method returns, contains the WorkBook
instance loaded from the |
LoadingOptions | options | Advanced options when importing non Excel formats. |
Returns
Type | Description |
---|---|
System.Boolean | true if workbook from the |
TryLoad(String, out WorkBook, String, ExcelFileFormat)
Loads the specified workbook to its WorkBook instance and returns a value that indicates whether the load succeeded.
Declaration
public static bool TryLoad(string filename, out WorkBook workBook, string listDelimiter = null, ExcelFileFormat fileFormat)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
WorkBook | workBook | When this method returns, contains the WorkBook
instance loaded from the |
System.String | listDelimiter | The list delimiter. |
ExcelFileFormat | fileFormat | The file format. |
Returns
Type | Description |
---|---|
System.Boolean | true if workbook from the |
TryLoad(String, String, out WorkBook)
Loads the specified workbook using provided password to its WorkBook instance and returns a value that indicates whether the load succeeded.
Declaration
public static bool TryLoad(string filename, string password, out WorkBook workBook)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
System.String | password | Password (cannot be null) |
WorkBook | workBook | When this method returns, contains the WorkBook
instance loaded from the |
Returns
Type | Description |
---|---|
System.Boolean | true if workbook from the |
TryLoadExcel(String, out WorkBook)
Loads the specified workbook to its WorkBook instance and returns a value that indicates whether the load succeeded.
Declaration
public static bool TryLoadExcel(string filename, out WorkBook workBook)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
WorkBook | workBook | When this method returns, contains the WorkBook
instance loaded from the |
Returns
Type | Description |
---|---|
System.Boolean | true if workbook from the |
TryLoadExcel(String, String, out WorkBook)
Loads the specified workbook using provided password to its WorkBook instance and returns a value that indicates whether the load succeeded.
Declaration
public static bool TryLoadExcel(string filename, string password, out WorkBook workBook)
Parameters
Type | Name | Description |
---|---|---|
System.String | filename | The path of the file to load. |
System.String | password | Password (cannot be null) |
WorkBook | workBook | When this method returns, contains the WorkBook
instance loaded from the |
Returns
Type | Description |
---|---|
System.Boolean | true if workbook from the |