Class WorkbookImpl
This class represents an Excel Workbook.
Inherited Members
Namespace: Syncfusion.XlsIO.Implementation
Assembly: Syncfusion.XlsIO.Base.dll
Syntax
public class WorkbookImpl : CommonObject, IDisposable, IWorkbook, IParentApplication
Constructors
WorkbookImpl(IApplication, Object, ExcelVersion)
Base constructor which must be used when workbook is created from scratch (maybe clipboard data)and not from file.
Declaration
public WorkbookImpl(IApplication application, object parent, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| ExcelVersion | version | Excel version. |
WorkbookImpl(IApplication, Object, Int32, ExcelVersion)
Creates workbook with specific number of worksheets.
Declaration
public WorkbookImpl(IApplication application, object parent, int sheetQuantity, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.Int32 | sheetQuantity | Quantity of empty worksheets to create. |
| ExcelVersion | version | Excel version. |
WorkbookImpl(IApplication, Object, Stream, ExcelParseOptions, ExcelVersion)
Create Workbook from stream.
Declaration
public WorkbookImpl(IApplication application, object parent, Stream stream, ExcelParseOptions options, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.IO.Stream | stream | Stream that contains workbook's data. |
| ExcelParseOptions | options | Parse options. |
| ExcelVersion | version | Excel version. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | When specified stream is NULL. |
WorkbookImpl(IApplication, Object, Stream, ExcelParseOptions, Boolean, String, ExcelVersion)
Initializes a new instance of the WorkbookImpl class.
Declaration
public WorkbookImpl(IApplication application, object parent, Stream stream, ExcelParseOptions options, bool bReadOnly, string password, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.IO.Stream | stream | |
| ExcelParseOptions | options | Parse options. |
| System.Boolean | bReadOnly | Indicates whether to open workbook in read-only mode. |
| System.String | password | Password to decrypt workbook stream. |
| ExcelVersion | version | Excel version. |
Exceptions
| Type | Condition |
|---|---|
| System.ApplicationException | When can't find workbook stream in the file. |
WorkbookImpl(IApplication, Object, Stream, ExcelVersion)
Create Workbook from stream.
Declaration
public WorkbookImpl(IApplication application, object parent, Stream stream, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.IO.Stream | stream | Stream that contains workbook's data. |
| ExcelVersion | version | Excel version. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | When specified stream is NULL. |
WorkbookImpl(IApplication, Object, Stream, String, Int32, Int32, ExcelVersion, String, Encoding)
Create WorkBook from file.
Declaration
public WorkbookImpl(IApplication application, object parent, Stream stream, string separator, int row, int column, ExcelVersion version, string fileName, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.IO.Stream | stream | Stream to open. |
| System.String | separator | Denotes separator for the CSV file types. |
| System.Int32 | row | Number of first row to write. |
| System.Int32 | column | Number of first column to write. |
| ExcelVersion | version | Excel version. |
| System.String | fileName | Filename is used to generate worksheet name |
| System.Text.Encoding | encoding |
WorkbookImpl(IApplication, Object, String, ExcelParseOptions, ExcelVersion)
Create Workbook from file.
Declaration
public WorkbookImpl(IApplication application, object parent, string strFileName, ExcelParseOptions options, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.String | strFileName | Name of the file with workbook. |
| ExcelParseOptions | options | Parse options. |
| ExcelVersion | version | Excel version. |
Exceptions
| Type | Condition |
|---|---|
| System.ApplicationException | When can't find workbook stream in the file. |
WorkbookImpl(IApplication, Object, String, ExcelParseOptions, Boolean, String, ExcelVersion)
Create Workbook from file.
Declaration
public WorkbookImpl(IApplication application, object parent, string strFileName, ExcelParseOptions options, bool bReadOnly, string password, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.String | strFileName | Name of the file with workbook. |
| ExcelParseOptions | options | Parse options. |
| System.Boolean | bReadOnly | Indicates whether to open workbook in read-only mode. |
| System.String | password | Password to decrypt workbook stream. |
| ExcelVersion | version | Excel version. |
Exceptions
| Type | Condition |
|---|---|
| System.ApplicationException | When can't find workbook stream in the file. |
WorkbookImpl(IApplication, Object, String, ExcelVersion)
Create Workbook from file.
Declaration
public WorkbookImpl(IApplication application, object parent, string FileName, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Application object for the workbook. |
| System.Object | parent | Parent object for the workbook. |
| System.String | FileName | Name of the file with workbook. |
| ExcelVersion | version | Excel version. |
Exceptions
| Type | Condition |
|---|---|
| System.ApplicationException | When can't find workbook stream in the file. |
WorkbookImpl(IApplication, Object, XmlReader, ExcelXmlOpenType)
Parses new workbook from xml stream.
Declaration
public WorkbookImpl(IApplication application, object parent, XmlReader reader, ExcelXmlOpenType openType)
Parameters
| Type | Name | Description |
|---|---|---|
| IApplication | application | Current application |
| System.Object | parent | Parent object. |
| System.Xml.XmlReader | reader | Xml reader. |
| ExcelXmlOpenType | openType | Xml open type. |
Fields
DEF_BAD_SHEET_NAME
Declaration
public const string DEF_BAD_SHEET_NAME = "#REF"
Field Value
| Type | Description |
|---|---|
| System.String |
DEF_FIRST_USER_COLOR
First user-defined color.
Declaration
public const int DEF_FIRST_USER_COLOR = 8
Field Value
| Type | Description |
|---|---|
| System.Int32 |
Properties
ActiveSheet
Gets an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active. Read-only.
Declaration
public IWorksheet ActiveSheet { get; }
Property Value
| Type | Description |
|---|---|
| IWorksheet |
ActiveSheetIndex
Gets or sets index of the active sheet.
Declaration
public int ActiveSheetIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
AddInFunctions
Gets collection of add-in functions. Read-only.
Declaration
public IAddInFunctions AddInFunctions { get; }
Property Value
| Type | Description |
|---|---|
| IAddInFunctions |
AlgorithmName
Alogrithm name to protect/unprotect workbook.
Declaration
public string AlgorithmName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Allow3DRangesInDataValidation
Indicates whether to allow usage of 3D ranges in DataValidation list property (MS Excel doesn't allow).
Declaration
public bool Allow3DRangesInDataValidation { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ArgumentsSeparator
Gets the formula arguments separator.
Declaration
public string ArgumentsSeparator { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Examples
The following code snippet illustrates how to get the argument separator.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Get the chart argumentSeparator.
string argumentSeparator = workbook.ArgumentsSeparator;
Author
Gets or sets the author of the comment.
Declaration
public string Author { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Examples
The following code snippet illustrates how to get the built in document properties.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Get the built in document properties.
IBuiltInDocumentProperties builtInDocumentProperties = workbook.BuiltInDocumentProperties;
string author = builtInDocumentProperties.Author;
BeginVersion
Beginning version of Excel
Declaration
public int BeginVersion { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
BuiltInDocumentProperties
Gets collection that represents all the built-in document properties for the specified workbook. Read-only.
Declaration
public IBuiltInDocumentProperties BuiltInDocumentProperties { get; }
Property Value
| Type | Description |
|---|---|
| IBuiltInDocumentProperties |
CalculationOptions
Gets calculation options. Read-only.
Declaration
public ICalculationOptions CalculationOptions { get; }
Property Value
| Type | Description |
|---|---|
| ICalculationOptions |
Examples
The following code snippet illustrates how to get the calculation options.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Get the calculation options.
ICalculationOptions calculationOptions = workbook.CalculationOptions;
Charts
Gets the collection of the chart objects.
Declaration
public ICharts Charts { get; }
Property Value
| Type | Description |
|---|---|
| ICharts |
CheckCompability
Specifies wheather the workbook checks the Compability of earlier version
Declaration
public bool CheckCompability { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
CodeName
Name which used by macros to access to workbook items.
Declaration
public string CodeName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Connections
Gets the connection. Read Only.
Declaration
public IConnections Connections { get; }
Property Value
| Type | Description |
|---|---|
| IConnections |
Examples
The following code snippet illustrates how to get the connection string.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Get the connection string.
IConnections connections = workbook.Connections;
ContentTypeProperties
Gets a MetaProperties collection that describes the meta data stored in the workbook. Read-only.
Declaration
public IMetaProperties ContentTypeProperties { get; }
Property Value
| Type | Description |
|---|---|
| IMetaProperties |
ControlsStream
Gets value indicating whether workbook controls stream or not. Read-only.
Declaration
public Stream ControlsStream { get; }
Property Value
| Type | Description |
|---|---|
| System.IO.Stream |
CurrentHeaderId
First free shape id.
Declaration
public int CurrentHeaderId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
CurrentObjectId
Declaration
public int CurrentObjectId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
CustomDocumentProperties
Gets collection that represents all the custom document properties for the specified workbook. Read-only.
Declaration
public ICustomDocumentProperties CustomDocumentProperties { get; }
Property Value
| Type | Description |
|---|---|
| ICustomDocumentProperties |
Examples
The following code snippet illustrates how to get the custom document properties.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Get the document properties.
ICustomDocumentProperties documentProperties = workbook.CustomDocumentProperties;
CustomXmlparts
Gets collection that represents all the CustomXmlParts collection for the specified workbook. Read-only.
Declaration
public ICustomXmlPartCollection CustomXmlparts { get; }
Property Value
| Type | Description |
|---|---|
| ICustomXmlPartCollection |
Examples
The following code snippet illustrates how to get the custom Xml parts.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Get the customXml parts.
ICustomXmlPartCollection CustomXmlparts = workbook.CustomXmlparts;
DataHolder
/Return file data holder, used to store data for Excel 2007 format.
Declaration
public FileDataHolder DataHolder { get; }
Property Value
| Type | Description |
|---|---|
| FileDataHolder |
Date1904
True if the workbook uses the 1904 date system.
Declaration
public bool Date1904 { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DefaultThemeVersion
Indicates default theme version for wokbook
Declaration
public string DefaultThemeVersion { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
DefaultXFIndex
Returns index to the default extended format.
Declaration
public int DefaultXFIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
DeletedConnections
Deleted connections
Declaration
public IConnections DeletedConnections { get; }
Property Value
| Type | Description |
|---|---|
| IConnections |
DetectDateTimeInValue
Indicates whether detect string value passed to Value (and Value2) property as DateTime. Default value is true.
Declaration
public bool DetectDateTimeInValue { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Setting this property to false can increase performance.
DisableMacrosStart
Disables loading of macros from document.
Declaration
public bool DisableMacrosStart { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
Excel on file open will simply skip macros and will work as if document does not contain them. This options works only when file contains macros (HasMacros property is True).
DisplayedTab
Gets or sets index of tab which will be displayed on document open.
Declaration
public int DisplayedTab { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
DisplayWorkbookTabs
True if the tabs are visible. otherwise False.
Declaration
public bool DisplayWorkbookTabs { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ExternWorkbooks
Returns collection of external workbooks.
Declaration
public ExternBookCollection ExternWorkbooks { get; }
Property Value
| Type | Description |
|---|---|
| ExternBookCollection |
FirstCharSize
Declaration
public int FirstCharSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
FormulaUtil
Returns class for formula parsing. Read-only.
Declaration
[CLSCompliant(false)]
public FormulaUtil FormulaUtil { get; }
Property Value
| Type | Description |
|---|---|
| FormulaUtil |
FullFileName
Returns name of the file the workbook was saved in last time or loaded from.
Declaration
public string FullFileName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
HasDuplicatedNames
Indicates whether original file contains duplicated external names.
Declaration
public bool HasDuplicatedNames { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
HashValue
Hash value to ensure the workbook protected password.
Declaration
public byte[] HashValue { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Byte[] |
HasMacros
True if workbook contains Vba macros. Read-only.
Declaration
public bool HasMacros { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
HasOleObjects
Indicates whether book has oleObjects
Declaration
public bool HasOleObjects { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
HeaderFooterData
Returns data that is shared by all header/footers.
Declaration
public WorkbookShapeDataImpl HeaderFooterData { get; }
Property Value
| Type | Description |
|---|---|
| WorkbookShapeDataImpl |
HeapHandle
Declaration
public IntPtr HeapHandle { get; }
Property Value
| Type | Description |
|---|---|
| System.IntPtr |
HidePivotFieldList
Indicates whether pivot table fields option is hidden or not.
Declaration
public bool HidePivotFieldList { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
InnerAddInFunctions
Returns collection of add-in functions. Read-only.
Declaration
public AddInFunctionsCollection InnerAddInFunctions { get; }
Property Value
| Type | Description |
|---|---|
| AddInFunctionsCollection |
InnerCalculation
Returns calculation options. Read-only.
Declaration
public CalculationOptionsImpl InnerCalculation { get; }
Property Value
| Type | Description |
|---|---|
| CalculationOptionsImpl |
InnerCharts
Charts collection.
Declaration
protected ChartsCollection InnerCharts { get; }
Property Value
| Type | Description |
|---|---|
| ChartsCollection |
InnerContentTypeProperties
Return ContententType Properties from the workbook
Declaration
public MetaPropertiesImpl InnerContentTypeProperties { get; }
Property Value
| Type | Description |
|---|---|
| MetaPropertiesImpl |
InnerCustomXmlParts
Return CustomXmlParts from the workbook
Declaration
public CustomXmlPartCollection InnerCustomXmlParts { get; }
Property Value
| Type | Description |
|---|---|
| CustomXmlPartCollection |
InnerExtFormatRecords
Declaration
protected List<ExtendedFormatRecord> InnerExtFormatRecords { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<ExtendedFormatRecord> |
InnerExtFormats
Collection of all ExtendedFormats used in the workbook.
Declaration
public ExtendedFormatsCollection InnerExtFormats { get; }
Property Value
| Type | Description |
|---|---|
| ExtendedFormatsCollection |
InnerFonts
Collection of all fonts used in the workbook. Read-only.
Declaration
public FontsCollection InnerFonts { get; }
Property Value
| Type | Description |
|---|---|
| FontsCollection |
InnerFormats
Collection of all formats used in the workbook. Read-only.
Declaration
public FormatsCollection InnerFormats { get; }
Property Value
| Type | Description |
|---|---|
| FormatsCollection |
InnerGraphics
Returns workbook graphics.
Declaration
public Graphics InnerGraphics { get; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Graphics |
InnerNamesColection
Return WorkbookNamesColection from parent WorkBook.
Declaration
public WorkbookNamesCollection InnerNamesColection { get; }
Property Value
| Type | Description |
|---|---|
| WorkbookNamesCollection |
InnerPalette
Returns internal array with palette colors. Read-only.
Declaration
public List<Color> InnerPalette { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<System.Drawing.Color> |
InnerSST
SSTDictionary that contains all strings used in the workbook. Read-only.
Declaration
public SSTDictionary InnerSST { get; }
Property Value
| Type | Description |
|---|---|
| SSTDictionary |
InnerStyles
Declaration
protected StylesCollection InnerStyles { get; }
Property Value
| Type | Description |
|---|---|
| StylesCollection |
InnerWorksheetGroup
Returns grouped worksheets. Read-only.
Declaration
public WorksheetGroup InnerWorksheetGroup { get; }
Property Value
| Type | Description |
|---|---|
| WorksheetGroup |
InnerWorksheets
Worksheets collection.
Declaration
protected WorksheetsCollection InnerWorksheets { get; }
Property Value
| Type | Description |
|---|---|
| WorksheetsCollection |
InnerXFExtRecords
Declaration
protected List<ExtendedXFRecord> InnerXFExtRecords { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<ExtendedXFRecord> |
IsCellProtection
True if cells are protected. Read-only.
Declaration
public bool IsCellProtection { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsHScrollBarVisible
Gets/Sets value to display horizontal scrollbar
Declaration
public bool IsHScrollBarVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Examples
This sample shows how to hide horizontal scroll bar.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.IsHScrollBarVisible = false;
IsLoaded
Gets value indicating whether workbook was loaded from file or stream.
Declaration
public bool IsLoaded { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsOleObjectCopied
Indicates whether Ole Objects are copied
Declaration
public bool IsOleObjectCopied { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
This property is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
IsRightToLeft
Indicates whether worksheet is displayed right to left.
Declaration
public bool IsRightToLeft { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsVScrollBarVisible
Gets/Sets value to display vertical scrollbar
Declaration
public bool IsVScrollBarVisible { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Examples
This sample shows how to hide vertical scroll bar.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.IsVScrollBarVisible = false;
IsWindowProtection
True if window is protected. Read-only.
Declaration
public bool IsWindowProtection { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Loading
Indicates whether workbook is loading. Read-only.
Declaration
public bool Loading { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
MaxColumnCount
Gets maximum column count for each worksheet in the workbook. Read-only.
Declaration
public int MaxColumnCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MaxDigitWidth
Declaration
public double MaxDigitWidth { get; }
Property Value
| Type | Description |
|---|---|
| System.Double |
MaxImportColumns
Maximum columns to import
Declaration
public int MaxImportColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MaxIndent
Gets maximum possible indent value. Read-only.
Declaration
public int MaxIndent { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MaxRowCount
Gets maximum row count for each worksheet in the workbook. Read-only.
Declaration
public int MaxRowCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MaxTableIndex
Gets or sets maximum used table (list object) index.
Declaration
public int MaxTableIndex { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MaxXFCount
Gets maximum possible number of extended formats. Read-only.
Declaration
public int MaxXFCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Names
Gets Names collection.
Declaration
public INames Names { get; }
Property Value
| Type | Description |
|---|---|
| INames |
Remarks
For an Application object, returns a Names collection that represents all the names in the active workbook. For a Workbook object, returns a Names collection that represents all the names in the specified workbook (including all worksheet-specific names).
Examples
The following code snippet illustrates how to get names.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
INames names = workbook.Names;
ObjectCount
Returns count of charts and worksheets in the workbook.
Declaration
public int ObjectCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Objects
Returns collection of named objects owned by the workbook (worksheet and charts). Read-only.
Declaration
protected WorkbookObjectsCollection Objects { get; }
Property Value
| Type | Description |
|---|---|
| Syncfusion.XlsIO.Implementation.Collections.WorkbookObjectsCollection |
OleStorageCollection
OleStorageCollection of workbook
Declaration
public OleStorageCollection OleStorageCollection { get; }
Property Value
| Type | Description |
|---|---|
| OleStorageCollection |
Palette
Declaration
public Color[] Palette { get; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Color[] |
Palettte
Gets a Palette of colors the Excel document can have. Here is a Table of color indexes their places in the color tool box provided by XlsIO application:
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ---+---------------------------------------- |0 | 00 | 51 | 50 | 49 | 47 | 10 | 53 | 54 | |1 | 08 | 45 | 11 | 09 | 13 | 04 | 46 | 15 | |2 | 02 | 44 | 42 | 48 | 41 | 40 | 12 | 55 | |3 | 06 | 43 | 05 | 03 | 07 | 32 | 52 | 14 | |4 | 37 | 39 | 35 | 34 | 33 | 36 | 38 | 01 | ---+---------------------------------------- |5 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | |6 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Declaration
public Color[] Palettte { get; }
Property Value
| Type | Description |
|---|---|
| System.Drawing.Color[] |
PasswordRev4
Declaration
[CLSCompliant(false)]
protected PasswordRev4Record PasswordRev4 { get; set; }
Property Value
| Type | Description |
|---|---|
| PasswordRev4Record |
PasswordToOpen
Gets or sets password to encrypt document.
Declaration
public string PasswordToOpen { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
PivotCaches
Gets pivot caches collection. Read-only.
Declaration
public PivotCacheCollection PivotCaches { get; }
Property Value
| Type | Description |
|---|---|
| PivotCacheCollection |
Examples
The following code snippet illustrates how to get pivot caches.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IPivotCaches pivotCaches = workbook.PivotCaches;
PrecisionAsDisplayed
True if the workbook uses precision. Read-only.
Declaration
public bool PrecisionAsDisplayed { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ProtectionRev4
Declaration
[CLSCompliant(false)]
protected ProtectionRev4Record ProtectionRev4 { get; set; }
Property Value
| Type | Description |
|---|---|
| ProtectionRev4Record |
ReadOnly
True if the workbook has been opened as Read-only. Read-only Boolean.
Declaration
public bool ReadOnly { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ReadOnlyRecommended
True to display a message when the file is opened, recommending that the file be opened as read-only.
Declaration
public bool ReadOnlyRecommended { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
RowSeparator
Gets or sets row separator for array parsing.
Declaration
public string RowSeparator { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
Examples
The following code snippet illustrates how to get row separator.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string rowSeparator = workbook.RowSeparator;
SaltValue
Random generated Salt for the workbook password.
Declaration
public byte[] SaltValue { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Byte[] |
Saved
True if no changes have been made to the specified workbook since it was last saved. If current value is false then setting it to true cause Save() method call.
Declaration
public bool Saved { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Saving
Indicates whether workbook is in saving process. Read-only.
Declaration
public bool Saving { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SecondCharSize
Declaration
public int SecondCharSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ShapesData
Returns data that is shared by all shapes (global options, unique pictures, etc. ).
Declaration
public WorkbookShapeDataImpl ShapesData { get; }
Property Value
| Type | Description |
|---|---|
| WorkbookShapeDataImpl |
SpinCount
Spin count to loop the hash algorithm.
Declaration
public uint SpinCount { get; set; }
Property Value
| Type | Description |
|---|---|
| System.UInt32 |
StandardFont
Gets or sets the name of the standard font.
Declaration
public string StandardFont { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
StandardFontSize
Gets or sets the standard font size.
Declaration
public double StandardFontSize { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
StandardRowHeight
Gets or sets standard ( default ) row height of all the worksheets. in points. Double.
Declaration
public double StandardRowHeight { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Double |
StandardRowHeightInPixels
Gets or sets row height in pixels
Declaration
public int StandardRowHeightInPixels { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Styles
Gets a Styles collection that represents all the styles in the specified workbook. Read-only.
Declaration
public IStyles Styles { get; }
Property Value
| Type | Description |
|---|---|
| IStyles |
Examples
The following code snippet illustrates how to get the styles.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IStyles styles = workbook.Styles;
TableStyles
create and gets the table styles.
Declaration
public ITableStyles TableStyles { get; }
Property Value
| Type | Description |
|---|---|
| ITableStyles |
TabSheets
Gets collection with all tabsheets in the workbook. Read-only.
Declaration
public ITabSheets TabSheets { get; }
Property Value
| Type | Description |
|---|---|
| ITabSheets |
Examples
The following code snippet illustrates how to get the tabsheets.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
ITabSheets tabsheets = workbook.TabSheets;
ThrowOnUnknownNames
Indicates whether exception should be thrown when unknown name was found in a formula.
Declaration
public bool ThrowOnUnknownNames { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Examples
The following code snippet illustrates how to gets or sets the ThrowOnUnknownNames.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.ThrowOnUnknownNames = true;
bool isThrowOnUnknownNames = workbook.ThrowOnUnknownNames;
UseFastStringSearching
Toggles string searching algorithm.Default value is true.
Declaration
public bool UseFastStringSearching { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Remarks
If true then Dictionary will be used to locate string inside strings dictionary. This mode is faster but uses more memory. If false then each time string is added to strings dictionary we will have to iterate through it and compare new strings with existing ones.
VbaProject
Declaration
public IVbaProject VbaProject { get; }
Property Value
| Type | Description |
|---|---|
| IVbaProject |
Version
Gets / sets excel version.
Declaration
public ExcelVersion Version { get; set; }
Property Value
| Type | Description |
|---|---|
| ExcelVersion |
WindowOne
Stores the attributes of the workbook window. Read-only.
Declaration
[CLSCompliant(false)]
public WindowOneRecord WindowOne { get; }
Property Value
| Type | Description |
|---|---|
| WindowOneRecord |
WorksheetGroup
Gets grouped worksheets. Read-only.
Declaration
public IWorksheetGroup WorksheetGroup { get; }
Property Value
| Type | Description |
|---|---|
| IWorksheetGroup |
Examples
The following code snippet illustrates how to get the grouped sheet.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheetGroup worksheetGroup = workbook.WorksheetGroup;
Worksheets
Gets a Sheets collection that represents all the worksheets in the specified workbook. Read-only Sheets object.
Declaration
public IWorksheets Worksheets { get; }
Property Value
| Type | Description |
|---|---|
| IWorksheets |
Examples
The following code snippet illustrates how to get the worksheets.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IWorksheets worksheets = workbook.Worksheets;
XmlMaps
Returns the collection of XmlMap object. Read-Only.
Declaration
public XmlMapCollection XmlMaps { get; }
Property Value
| Type | Description |
|---|---|
| XmlMapCollection |
Methods
Activate()
Activates the first window associated with the workbook.
Declaration
public void Activate()
AddBrokenSheetReference()
Adds incorrect sheet reference.
Declaration
protected int AddBrokenSheetReference()
Returns
| Type | Description |
|---|---|
| System.Int32 | Worksheet to be referenced. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | When can't find specified worksheet in this workbook. |
AddFont(IFont)
Adds font to the inner fonts collection. Read-only.
Declaration
public IFont AddFont(IFont fontToAdd)
Parameters
| Type | Name | Description |
|---|---|---|
| IFont | fontToAdd | Font to add. |
Returns
| Type | Description |
|---|---|
| IFont | Current font with correct font index, or same font from the collection if was added before. |
Examples
The following code illustrates how to add font in the collections.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IFont font = workbook.CreateFont();
workbook.AddFont(font);
AddSheetReference(ITabSheet)
Adds internal sheet reference.
Declaration
protected int AddSheetReference(ITabSheet sheet)
Parameters
| Type | Name | Description |
|---|---|---|
| ITabSheet | sheet | Name of the sheet that should be referenced. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Worksheet to be referenced. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | When can't find specified worksheet in this workbook. |
AddSheetReference(IWorksheet)
Adds internal sheet reference.
Declaration
protected int AddSheetReference(IWorksheet sheet)
Parameters
| Type | Name | Description |
|---|---|---|
| IWorksheet | sheet | Name of the sheet that should be referenced. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Worksheet to be referenced. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | When can't find specified worksheet in this workbook. |
AddSheetReference(IWorksheet, IWorksheet)
Adds internal sheet reference.
Declaration
protected int AddSheetReference(IWorksheet sheet, IWorksheet lastSheet)
Parameters
| Type | Name | Description |
|---|---|---|
| IWorksheet | sheet | Name of the sheet that should be referenced. |
| IWorksheet | lastSheet |
Returns
| Type | Description |
|---|---|
| System.Int32 | Worksheet to be referenced. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | When can't find specified worksheet in this workbook. |
AddSheetReference(Int32, Int32, Int32)
This method adds one TREF structure to the list.
Declaration
protected int AddSheetReference(int supIndex, int firstSheetIndex, int lastSheetIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | supIndex | SUPBOOK index. |
| System.Int32 | firstSheetIndex | Index to first SUPBOOK sheet. |
| System.Int32 | lastSheetIndex | Index to last SUPBOOK sheet. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Index of the old REF structure (if there was one) or new REF structure. |
AddSheetReference(String)
Adds internal sheet reference.
Declaration
protected int AddSheetReference(string inputSheetName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | inputSheetName |
Returns
| Type | Description |
|---|---|
| System.Int32 | Index to the sheet in ExternSheetRecord. |
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentException | When can't find specified worksheet in this workbook. |
ClearAll()
Clears all internal collections.
Declaration
protected void ClearAll()
Clone()
Creates copy of the current instance.
Declaration
public IWorkbook Clone()
Returns
| Type | Description |
|---|---|
| IWorkbook | Copy of the current instance. |
Close()
Closes the object without saving.
Declaration
public void Close()
Examples
The following code illustrate how to closes the object without saving.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.Close();
Close(Boolean)
Closes the object. If True, all changes will be saved.
Declaration
public void Close(bool saveChanges)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | saveChanges | If True, all changes will be saved. |
Examples
The following code illustrate how to closes the object with specified bool value.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.Close(true);
Close(Boolean, String)
Closes the object and saves workbook to the specified file name.If True, all changes will be saved.
Declaration
public void Close(bool SaveChanges, string Filename)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | SaveChanges | If True, all changes will be saved. |
| System.String | Filename | Name of the file. |
Examples
The following code illustrates how to Closes the object and saves workbook to the specified file name.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.Close(true,"Output.xlsx");
Close(String)
Closes the object and saves workbook to the specified file name.
Declaration
public void Close(string Filename)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | Filename | File name in which workbook will be saved if SaveChanges is true. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code illustrates how to closes the object and saves workbook with specified name.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.Close("Output.xlsx");
ColorDistance(Color, Color)
Calculates distance between two colors.
Declaration
protected double ColorDistance(Color color1, Color color2)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | color1 | First color. |
| System.Drawing.Color | color2 | Second color. |
Returns
| Type | Description |
|---|---|
| System.Double | Distance between two colors. |
ContainsFont(FontImpl)
Declaration
public bool ContainsFont(FontImpl font)
Parameters
| Type | Name | Description |
|---|---|---|
| FontImpl | font |
Returns
| Type | Description |
|---|---|
| System.Boolean |
CopyExternSheets(ExternSheetRecord, Dictionary<Int32, Int32>)
Copies externsheets to to another workbook.
Declaration
[CLSCompliant(false)]
public Dictionary<int, int> CopyExternSheets(ExternSheetRecord externSheet, Dictionary<int, int> hashSubBooks)
Parameters
| Type | Name | Description |
|---|---|---|
| ExternSheetRecord | externSheet | Represents base extern sheets. |
| System.Collections.Generic.Dictionary<System.Int32, System.Int32> | hashSubBooks | Represents dictionary with new sub books indexes. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.Dictionary<System.Int32, System.Int32> | Dictioanry with new indexes. Key - old index; value - new index. |
CopyPaletteColorTo(WorkbookImpl)
Copies palette colors to workbook/
Declaration
public void CopyPaletteColorTo(WorkbookImpl destinationWorkbook)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkbookImpl | destinationWorkbook | Workbook to copy palette into. |
CopyToClipboard()
Copies to the clipboard whole workbook.
Declaration
public void CopyToClipboard()
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
CopyToClipboard(WorksheetImpl)
Copies to clipboard the selected worksheet or all worksheets if sheet is NULL.
Declaration
protected void CopyToClipboard(WorksheetImpl sheet)
Parameters
| Type | Name | Description |
|---|---|---|
| WorksheetImpl | sheet | Worksheet that would be copied into the clipboard. |
CreateDataSorter()
Creates the Data sorter to sort the data..
Declaration
public IDataSort CreateDataSorter()
Returns
| Type | Description |
|---|---|
| IDataSort | Data Sorter. |
CreateExtFormat(IExtendedFormat, Boolean)
Creates extended format based on baseFormat and registers it in workbook.
Declaration
protected IExtendedFormat CreateExtFormat(IExtendedFormat baseFormat, bool bForceAdd)
Parameters
| Type | Name | Description |
|---|---|---|
| IExtendedFormat | baseFormat | Base format for the new format. |
| System.Boolean | bForceAdd | Indicates whether to force add. |
Returns
| Type | Description |
|---|---|
| IExtendedFormat | Newly created format. |
CreateExtFormat(Boolean)
Creates extended format record and registers it in workbook.
Declaration
protected IExtendedFormat CreateExtFormat(bool bForceAdd)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | bForceAdd | Indicates whether to force add to collection. |
Returns
| Type | Description |
|---|---|
| IExtendedFormat | Newly created extended format. |
CreateExtFormatWithoutRegister(IExtendedFormat)
Creates extended format based on baseFormat without registering it in the workbook.
Declaration
protected ExtendedFormatImpl CreateExtFormatWithoutRegister(IExtendedFormat baseFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| IExtendedFormat | baseFormat | Base format for the new format. |
Returns
| Type | Description |
|---|---|
| ExtendedFormatImpl | Newly created format. |
CreateFont()
Creates a font object.
Declaration
public IFont CreateFont()
Returns
| Type | Description |
|---|---|
| IFont | Returns the newly created font. |
CreateFont(IFont)
Creates font object based on another font object.
Declaration
public IFont CreateFont(IFont baseFont)
Parameters
| Type | Name | Description |
|---|---|---|
| IFont | baseFont | Base font for the new one. |
Returns
| Type | Description |
|---|---|
| IFont | Returns a newly created font. |
CreateFont(IFont, Boolean)
Method that creates font object based on another font object and registers it in the workbook.
Declaration
public IFont CreateFont(IFont baseFont, bool bAddToCollection)
Parameters
| Type | Name | Description |
|---|---|---|
| IFont | baseFont | Base font for the new one. |
| System.Boolean | bAddToCollection | Indicates whether font should be added to the collection. |
Returns
| Type | Description |
|---|---|
| IFont | Newly created font. |
CreateFont(Font)
Creates a font object based on native font.
Declaration
public IFont CreateFont(Font nativeFont)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Font | nativeFont | Native font to get settings from. |
Returns
| Type | Description |
|---|---|
| IFont | returns newly created font. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code illustrates how to create a font object based on native font.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
System.Drawing.Font font = new System.Drawing.Font(System.Drawing.FontFamily.GenericSerif, 9);
workbook.CreateFont(font);
CreateHFEngine()
Creates header/footer engine.
Declaration
public IHFEngine CreateHFEngine()
Returns
| Type | Description |
|---|---|
| IHFEngine | New instance of header/footer engine. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
CreateSalt(Int32)
Creates random salt.
Declaration
protected byte[] CreateSalt(int length)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | length | Desired salt length. |
Returns
| Type | Description |
|---|---|
| System.Byte[] | Array with random data. |
CreateTemplateMarkersProcessor()
Create an instance that can be used for template markers processing.
Declaration
public ITemplateMarkersProcessor CreateTemplateMarkersProcessor()
Returns
| Type | Description |
|---|---|
| ITemplateMarkersProcessor | Returns the Object that can be used for template markers processing. |
CurrentStyleNumber(String)
Returns number from the style name, i.e. Normal_1 result is 1.
Declaration
protected int CurrentStyleNumber(string pre)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pre | Style name. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Parsed number. |
DecodeName(String)
Decodes name encoded in supbook.
Declaration
public string DecodeName(string strName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | strName | Name to decode. |
Returns
| Type | Description |
|---|---|
| System.String | Decoded name. |
DecreaseSheetIndex(Int32)
Decreases index (in ExternSheet record) of all worksheets with index that is smaller than specified index.
Declaration
protected void DecreaseSheetIndex(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
DeleteConnection(IConnection)
Delete Connection
Declaration
public void DeleteConnection(IConnection Connection)
Parameters
| Type | Name | Description |
|---|---|---|
| IConnection | Connection |
EncodeName(String)
Decodes name encoded in supbook.
Declaration
public string EncodeName(string strName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | strName | Name to decode. |
Returns
| Type | Description |
|---|---|
| System.String | Decoded name. |
FileWidthToPixels(Double)
Convert column width that is stored in file into pixels.
Declaration
public double FileWidthToPixels(double fileWidth)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | fileWidth | Column width in file. |
Returns
| Type | Description |
|---|---|
| System.Double | Column width in pixels. |
Finalize()
Class finalizer.
Declaration
protected void Finalize()
FindAll(Boolean)
Returns the cells of the specified bool value.
Declaration
public IRange[] FindAll(bool findValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | findValue | Value to search. |
Returns
| Type | Description |
|---|---|
| IRange[] | Returns all found cells, or Null if value was not found |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IRange[] range = workbook.FindAll(true);
FindAll(DateTime)
This method searches for the all cells with specified DateTime value.
Declaration
public IRange[] FindAll(DateTime findValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | findValue | Value to search. |
Returns
| Type | Description |
|---|---|
| IRange[] | All found cells, or Null if value was not found. |
FindAll(Double, ExcelFindType)
Returns the cells of the specified double value with the specified ExcelFindType.
Declaration
public IRange[] FindAll(double findValue, ExcelFindType flags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
Returns
| Type | Description |
|---|---|
| IRange[] | Returns all found cells, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IRange[] results = workbook.FindAll(100.32, ExcelFindType.Number);
FindAll(String, ExcelFindType)
Returns the cells with specified string value.
Declaration
public IRange[] FindAll(string findValue, ExcelFindType flags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
Returns
| Type | Description |
|---|---|
| IRange[] | Returns all found cells, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IRange[] results = workbook.FindAll("Hello World", ExcelFindType.Text);
FindAll(String, ExcelFindType, ExcelFindOptions)
Returns the cells of the specified string value with the specified ExcelFindType.
Declaration
public IRange[] FindAll(string findValue, ExcelFindType flags, ExcelFindOptions findOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
| ExcelFindOptions | findOptions | Way to search. |
Returns
| Type | Description |
|---|---|
| IRange[] | Returns all found cells, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IRange[] results = workbook.FindAll("Hello World", ExcelFindType.Text, ExcelFindOptions.MatchCase);
FindAll(TimeSpan)
Returns the cells of the specified TimeSpan value.
Declaration
public IRange[] FindAll(TimeSpan findValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.TimeSpan | findValue | Value to search. |
Returns
| Type | Description |
|---|---|
| IRange[] | Return all found cells, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
TimeSpan value = new TimeSpan(2, 30, 30);
IRange[] results = workbook.FindAll(value);
FindFirst(Boolean)
Returns the first occurrence of the specified bool value.
Declaration
public IRange FindFirst(bool findValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | findValue | Value to search. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
IRange result = workbook.FindFirst(true);
FindFirst(DateTime)
Returns the first occurrence of the specified DateTime value.
Declaration
public IRange FindFirst(DateTime findValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.DateTime | findValue | Value to search. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
DateTime dateTime = DateTime.Now;
IRange result = workbook.FindFirst(dateTime);
FindFirst(Double, ExcelFindType)
Returns the first occurrence of the specified double value with the specified ExcelFindType.
Declaration
public IRange FindFirst(double findValue, ExcelFindType flags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
double value = 9.00;
IRange result = workbook.FindFirst(value, ExcelFindType.Number);
FindFirst(String, ExcelFindType)
Returns the first occurrence of the specified string value with the specified ExcelFindType.
Declaration
public IRange FindFirst(string findValue, ExcelFindType flags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string value = "value";
IRange result = workbook.FindFirst(value, ExcelFindType.Text);
FindFirst(String, ExcelFindType, ExcelFindOptions)
Returns the first occurrence of the specified string value with the specified ExcelFindType and ExcelFindOptions.
Declaration
public IRange FindFirst(string findValue, ExcelFindType flags, ExcelFindOptions findOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
| ExcelFindOptions | findOptions | Way to search the value. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string findvalue = "value";
IRange result = workbook.FindFirst(findvalue, ExcelFindType.Text, ExcelFindOptions.None);
FindFirst(TimeSpan)
Returns the first occurrence of the specified TimeSpan value.
Declaration
public IRange FindFirst(TimeSpan findValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.TimeSpan | findValue | Value to search. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
TimeSpan timeSpan = new TimeSpan(2, 30, 30);
IRange result = workbook.FindFirst(timeSpan);
FindStringEndsWith(String, ExcelFindType)
Returns the first occurrence that ends with the specified string value.
Declaration
public IRange FindStringEndsWith(string findValue, ExcelFindType flags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string value = "value";
IRange result = workbook.FindStringEndsWith(value, ExcelFindType.Text);
FindStringEndsWith(String, ExcelFindType, Boolean)
Returns the first occurrence that ends with the specified string value which ignores the case.
Declaration
public IRange FindStringEndsWith(string findValue, ExcelFindType flags, bool ignoreCase)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
| System.Boolean | ignoreCase | true to ignore case wen comparing this string to the value;otherwise,false |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string value = "value";
IRange result = workbook.FindStringEndsWith(value, ExcelFindType.Text, true);
FindStringStartsWith(String, ExcelFindType)
Returns the first occurrence that starts with the specified string value.
Declaration
public IRange FindStringStartsWith(string findValue, ExcelFindType flags)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string value = "value";
IRange result = workbook.FindStringStartsWith(value, ExcelFindType.Text);
FindStringStartsWith(String, ExcelFindType, Boolean)
Returns the first occurrence that starts with the specified string value which ignores the case.
Declaration
public IRange FindStringStartsWith(string findValue, ExcelFindType flags, bool ignoreCase)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | findValue | Value to search. |
| ExcelFindType | flags | Type of value to search. |
| System.Boolean | ignoreCase | true to ignore case wen comparing this string to the value;otherwise,false |
Returns
| Type | Description |
|---|---|
| IRange | First found cell, or Null if value was not found. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string value = "value";
IRange result = workbook.FindStringStartsWith(value, ExcelFindType.Text, true);
GetBookIndex(Int32)
Returns extern workbook index by reference index.
Declaration
public int GetBookIndex(int iReferenceIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iReferenceIndex | Reference index. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Extern workbook index. |
GetDefaultXF(Int32)
Declaration
[CLSCompliant(false)]
protected ExtendedFormatRecord GetDefaultXF(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Returns
| Type | Description |
|---|---|
| ExtendedFormatRecord |
GetDefaultXFExt()
Declaration
[CLSCompliant(false)]
protected ExtendedXFRecord GetDefaultXFExt()
Returns
| Type | Description |
|---|---|
| ExtendedXFRecord |
GetExternSheet(Int32)
Returns external sheet object by reference index.
Declaration
public ExternWorksheetImpl GetExternSheet(int referenceIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | referenceIndex | Reference index. |
Returns
| Type | Description |
|---|---|
| ExternWorksheetImpl | External worksheet that corresponds to the specified reference index. |
GetExtFormat(Int32)
Declaration
public IExtendedFormat GetExtFormat(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
Returns
| Type | Description |
|---|---|
| IExtendedFormat |
GetMaxDigitHeight()
Evaluates maximum digit width of the font for Normal style.
Declaration
public double GetMaxDigitHeight()
Returns
| Type | Description |
|---|---|
| System.Double | Maximum digit width of the font for Normal style. |
GetMaxDigitHeight(Font)
Gets maximum digit height.
Declaration
public double GetMaxDigitHeight(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Font | font | Font to get digit height for. |
Returns
| Type | Description |
|---|---|
| System.Double | Maximum digit height. |
GetMaxDigitWidth()
Evaluates maximum digit width of the font for Normal style.
Declaration
public double GetMaxDigitWidth()
Returns
| Type | Description |
|---|---|
| System.Double | Maximum digit width of the font for Normal style. |
GetMaxDigitWidth(Font)
Evaluates maximum digit width of the specified font.
Declaration
public double GetMaxDigitWidth(Font font)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Font | font | Font to measure. |
Returns
| Type | Description |
|---|---|
| System.Double | Maximum digit width of the specified font. |
GetNearestColor(Color)
Gets the nearest color with the specified Color structure from Workbook palette.
Declaration
public ExcelKnownColors GetNearestColor(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | color | system color. |
Returns
| Type | Description |
|---|---|
| ExcelKnownColors | Returns Color index from workbook palette. |
GetNearestColor(Color, Int32)
Gets the nearest color to the specified Color structure from Workbook palette.
Declaration
public ExcelKnownColors GetNearestColor(Color color, int iStartIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | color | Color to look for. |
| System.Int32 | iStartIndex | Start index. |
Returns
| Type | Description |
|---|---|
| ExcelKnownColors | Color index from workbook palette. |
GetNearestColor(Int32, Int32, Int32)
Gets the nearest color with the specified red, green, and blue color values from Workbook palette.
Declaration
public ExcelKnownColors GetNearestColor(int r, int g, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | r | Red component of the color. |
| System.Int32 | g | Green component of the color. |
| System.Int32 | b | Blue component of the color. |
Returns
| Type | Description |
|---|---|
| ExcelKnownColors | Returns Color index from workbook palette. |
GetPaletteColor(ExcelKnownColors)
Returns Color object from predefined colors by its index.
Declaration
public Color GetPaletteColor(ExcelKnownColors color)
Parameters
| Type | Name | Description |
|---|---|---|
| ExcelKnownColors | color | Index from palette array. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Color | RGB Color. |
Examples
The following code illustrates how to get the color value for the specified excel known color.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
System.Drawing.Color color = workbook.GetPaletteColor(ExcelKnownColors.Aqua);
GetReferenceIndex(Int32)
Returns reference index by extern workbook index.
Declaration
public int GetReferenceIndex(int iNameBookIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iNameBookIndex | Index of the extern workbook. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Reference index if extern workbook was found; otherwise returns -1. |
GetSheetByReference(Int32)
Returns worksheet by its reference index.
Declaration
protected IWorksheet GetSheetByReference(int reference)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | reference | Reference index of the sheet. |
Returns
| Type | Description |
|---|---|
| IWorksheet | Found worksheet. |
Exceptions
| Type | Condition |
|---|---|
| ParseException | When can't find referenced worksheet. |
GetSheetByReference(Int32, Boolean)
Returns worksheet by its reference index.
Declaration
protected IWorksheet GetSheetByReference(int reference, bool bThrowExceptions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | reference | Reference index of the sheet. |
| System.Boolean | bThrowExceptions | Indicates whether to throw exception when can't find worksheet with specified index. |
Returns
| Type | Description |
|---|---|
| IWorksheet | Found worksheet. |
Exceptions
| Type | Condition |
|---|---|
| ParseException | When can't find referenced worksheet. |
GetSheetNameByReference(Int32)
Returns worksheet name.
Declaration
protected string GetSheetNameByReference(int reference)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | reference | Reference to worksheet. |
Returns
| Type | Description |
|---|---|
| System.String | Returns sheet name. |
GetSheetNameByReference(Int32, Boolean)
Returns worksheet name.
Declaration
protected string GetSheetNameByReference(int reference, bool completePath)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | reference | Reference to worksheet. |
| System.Boolean | completePath |
Returns
| Type | Description |
|---|---|
| System.String | Returns sheet name. |
GetThemeColor(Int32)
Returns theme color by its index.
Declaration
public Color GetThemeColor(int color)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | color |
Returns
| Type | Description |
|---|---|
| System.Drawing.Color |
ImportXml(Stream)
Import XML document in the workbook.
Declaration
public void ImportXml(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream of XML document. |
ImportXml(String)
Import XML document to the workbook.
Declaration
public void ImportXml(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName |
IncreaseSheetIndex(Int32)
Increases index (in ExternSheet record) of all worksheets with index that is larger or equal than specified index.
Declaration
protected void IncreaseSheetIndex(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index |
InitializeCollections()
Initializes all internal collections.
Declaration
protected void InitializeCollections()
InsertDefaultExtFormats()
Inserts all default extended formats into special list. Excel has 21 default formats for each workbook.
Declaration
protected void InsertDefaultExtFormats()
InsertDefaultStyles()
Inserts all default styles into special list.
Declaration
protected void InsertDefaultStyles()
InsertDefaultStyles(List<StyleRecord>)
Inserts all default styles into special list.
Declaration
protected void InsertDefaultStyles(List<StyleRecord> arrStyles)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<StyleRecord> | arrStyles | Styles that were read from file. |
IsExternalReference(Int32)
Declaration
public bool IsExternalReference(int reference)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | reference |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsFormatted(Int32)
Indicates whether specified xf index differs from the default one.
Declaration
public bool IsFormatted(int xfIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | xfIndex | XFIndex to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | True if there is no difference. |
IsLocalReference(Int32)
Indicates whether reference is reference to local worksheet.
Declaration
protected bool IsLocalReference(int reference)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | reference | Reference index. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Value that indicates whether reference is reference to local worksheet. |
MarkAsFinal()
Marks workbook as final. Read-Only.
Declaration
public void MarkAsFinal()
ModifyRecordToSkipStyle(BiffRecordRaw)
Modifies record in skip styles mode.
Declaration
[CLSCompliant(false)]
public bool ModifyRecordToSkipStyle(BiffRecordRaw record)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRaw | record | Record to modify. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Boolean value indicating that record should be added to the array. |
ModifyRecordToSkipStyle(BiffRecordRaw[])
Modifies record in skip styles mode.
Declaration
[CLSCompliant(false)]
public void ModifyRecordToSkipStyle(BiffRecordRaw[] arrRecords)
Parameters
| Type | Name | Description |
|---|---|---|
| Syncfusion.XlsIO.Parser.Biff_Records.BiffRecordRaw[] | arrRecords | Records to modify. |
MoveSheetIndex(Int32, Int32)
This method updates external sheet table when a worksheet was moved.
Declaration
protected void MoveSheetIndex(int iOldIndex, int iNewIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iOldIndex | Old index of the worksheet. |
| System.Int32 | iNewIndex | New index of the worksheet. |
Paste()
Copies workbook and all its worksheets to the clipboard.
Declaration
protected void Paste()
PixelsToWidth(Double)
Converts column width in pixels into column width in characters.
Declaration
public double PixelsToWidth(double pixels)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | pixels | Column width in pixels. |
Returns
| Type | Description |
|---|---|
| System.Double | Column width in characters. |
Protect(Boolean, Boolean)
Sets protection for workbook.
Declaration
public void Protect(bool bIsProtectWindow, bool bIsProtectContent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | bIsProtectWindow | Indicates if protect workbook window. |
| System.Boolean | bIsProtectContent | Indicates if protect workbook content. |
Examples
The following code snippet illustrates how to protect the workbook.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.Protect(true, true);
Protect(Boolean, Boolean, String)
Sets protection for workbook with password.
Declaration
public void Protect(bool bIsProtectWindow, bool bIsProtectContent, string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | bIsProtectWindow | Indicates if protect workbook window. |
| System.Boolean | bIsProtectContent | Indicates if protect workbook content. |
| System.String | password | Password to protect with. |
Examples
The following code snippet illustrates how to protect the workbook using password.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.Protect(true, true, "Password");
ReAddAllStrings()
Looks through all records and calls AddIncrease for each LabelSST record.
Declaration
public void ReAddAllStrings()
RegisterExtFormat(ExtendedFormatImpl)
Registers extended format.
Declaration
protected ExtendedFormatImpl RegisterExtFormat(ExtendedFormatImpl format)
Parameters
| Type | Name | Description |
|---|---|---|
| ExtendedFormatImpl | format | Format to register. |
Returns
| Type | Description |
|---|---|
| ExtendedFormatImpl | Format from the collection if there were such format; otherwise returns format that was added. |
RegisterExtFormat(ExtendedFormatImpl, Boolean)
Registers extended format.
Declaration
protected ExtendedFormatImpl RegisterExtFormat(ExtendedFormatImpl format, bool forceAdd)
Parameters
| Type | Name | Description |
|---|---|---|
| ExtendedFormatImpl | format | Format to register. |
| System.Boolean | forceAdd | Indicates whether to force format object registration in the collection. |
Returns
| Type | Description |
|---|---|
| ExtendedFormatImpl | Format from the collection if there were such format; otherwise returns format that was added. |
RemoveExtendedFormatIndex(Int32)
Removes extended format by its index.
Declaration
public void RemoveExtendedFormatIndex(int xfIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | xfIndex | Index to the extended format to remove. |
RemoveExtenededFormatIndex(Int32)
Removes extended format by its index.
Declaration
[Obsolete("This method is obsolete and will be removed soon. Please use RemoveExtendedFormatIndex(int xfIndex) method. Sorry for inconvenience.")]
public void RemoveExtenededFormatIndex(int xfIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | xfIndex | Index to the extended format to remove. |
Replace(String, DataColumn, Boolean)
Replaces string with the specified DataColumn value.
Declaration
public void Replace(string oldValue, DataColumn newValues, bool isFieldNamesShown)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.Data.DataColumn | newValues | Data table with new data. |
| System.Boolean | isFieldNamesShown | Indicates whether field name must be shown. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code snippet illustrates how to replace the string value with data table.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
// create the data table
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Rows.Add(1);
System.Data.DataColumn dataColumn = table.Columns[0];
string oldvalue = "AB2";
// Replace the value with data column.
workbook.Replace(oldvalue, dataColumn, true);
Replace(String, DataTable, Boolean)
Replaces string with the specified DataTable value.
Declaration
public void Replace(string oldValue, DataTable newValues, bool isFieldNamesShown)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.Data.DataTable | newValues | Data table with new data. |
| System.Boolean | isFieldNamesShown | Indicates whether field name must be shown. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code snippet illustrates how to replace the string value with data table.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
// create the data table
System.Data.DataTable table = new System.Data.DataTable();
table.Columns.Add("Dosage", typeof(int));
table.Rows.Add(1);
string oldvalue = "AB2";
// Replace the value with data table.
workbook.Replace(oldvalue, table, true);
Replace(String, DateTime)
Replaces string with the specified DateTime value.
Declaration
public void Replace(string oldValue, DateTime newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.DateTime | newValue | The DateTime value to replace all occurrences of oldValue. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string oldValue = "Find";
DateTime dateTime = DateTime.Now;
workbook.Replace(oldValue, dateTime);
Replace(String, Double)
Replaces string with the specified double value.
Declaration
public void Replace(string oldValue, double newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.Double | newValue | The double value to replace all occurrences of oldValue. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string oldValue = "Find";
double newValue = 9.00;
workbook.Replace(oldValue, newValue);
Replace(String, Double[], Boolean)
Replaces specified string with the specified array of double values.
Declaration
public void Replace(string oldValue, double[] newValues, bool isVertical)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.Double[] | newValues | Array of new values. |
| System.Boolean | isVertical | Indicates whether array should be inserted vertically. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string oldValue = "Find";
double[] newValues = { 1.00, 3.00 };
workbook.Replace(oldValue, newValues, true);
Replace(String, Int32[], Boolean)
Replaces specified string with the specified array of int values.
Declaration
public void Replace(string oldValue, int[] newValues, bool isVertical)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.Int32[] | newValues | Array of new values. |
| System.Boolean | isVertical | Indicates whether array should be inserted vertically. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string oldValue = "Find";
int[] newValues = { 1, 2 };
workbook.Replace(oldValue, newValues, true);
Replace(String, String)
Replaces string with the specified string value.
Declaration
public void Replace(string oldValue, string newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.String | newValue | The string to replace all occurrences of oldValue. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string oldValue = "Find";
string newValue = "NewValue";
workbook.Replace(oldValue, newValue);
Replace(String, String, ExcelFindOptions)
Declaration
public void Replace(string oldValue, string newValue, ExcelFindOptions findOptions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | |
| System.String | newValue | |
| ExcelFindOptions | findOptions |
Replace(String, String[], Boolean)
Replaces specified string with the specified array of string values.
Declaration
public void Replace(string oldValue, string[] newValues, bool isVertical)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oldValue | The string to be replaced. |
| System.String[] | newValues | Array of new values. |
| System.Boolean | isVertical | Indicates whether array should be inserted vertically. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
string oldValue = "Find";
string[] newValues = { "X values", "Y values" };
workbook.Replace(oldValue, newValues, true);
ResetPalette()
Recover palette to default values.
Declaration
public void ResetPalette()
Examples
The following code snippets illustrates how to reset the palette.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.ResetPalette();
Save()
Saves changes to the specified workbook.
Declaration
public void Save()
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.Save();
Exceptions
| Type | Condition |
|---|---|
| System.ApplicationException | If file name was not specified before. |
SaveAs(Stream)
Saves workbook as stream.
Declaration
public void SaveAs(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream that will receive workbook data. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
Stream stream = new MemoryStream();
workbook.SaveAs(stream);
SaveAs(Stream, ExcelSaveType)
Saves workbook as stream with specified ExcelSaveType.
Declaration
public void SaveAs(Stream stream, ExcelSaveType saveType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream that will receive workbook data. |
| ExcelSaveType | saveType | Type of the Excel file. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
Stream stream = new MemoryStream();
workbook.SaveAs(stream, ExcelSaveType.SaveAsXLS);
SaveAs(Stream, String)
Saves workbook as stream using separator. Used only for CSV files.
Declaration
public void SaveAs(Stream stream, string separator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to save. |
| System.String | separator | Denotes separator for the CSV file types. |
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
Stream stream = new MemoryStream();
workbook.SaveAs(stream, ",");
SaveAs(Stream, String, Encoding)
Saves workbook as stream with given separator and encoding. Used only for CSV files.
Declaration
public void SaveAs(Stream stream, string separator, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to save the CSV file. |
| System.String | separator | Denotes separator for the CSV file types. |
| System.Text.Encoding | encoding | The name of a character encoding that is supported by the .NET Framework. |
Remarks
This overloaded method can be used to apply encoding to the CSV file in particular. The default encoding type is UTF-8. Other encoding types include ASCII, UTF-7, and UTF-32.
Examples
using(ExcelEngine engine = new ExcelEngine())
{
IApplication application = engine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
worksheet["A1"].Text = "This";
worksheet["B1"].Text = "is";
worksheet["C1"].Text = "a";
worksheet["D1"].Text = "sample";
worksheet["E1"].Text = "to";
worksheet["F1"].Text = "set";
worksheet["G1"].Text = "encoding";
Stream stream = new MemoryStream();
workbook.SaveAs("Output.csv", ",",Encoding.Unicode);
}
SaveAs(String)
Saves workbook with the specified file name.
Declaration
public void SaveAs(string FileName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | FileName | Name of the file into which workbook will be saved. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SaveAs("Output.xls");
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | When FileName is NULL. |
| System.ArgumentException | When FileName is empty. |
SaveAs(String, ExcelSaveType)
Saves workbook with the specified file name and ExcelSaveType.
Declaration
public void SaveAs(string FileName, ExcelSaveType saveType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | FileName | Name of the file into which workbook will be saved. |
| ExcelSaveType | saveType | Options for save. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SaveAs("Output.xls", ExcelSaveType.SaveAsXLS);
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | When FileName is NULL. |
| System.ArgumentException | When FileName is empty. |
SaveAs(String, ExcelSaveType, ExcelVersion)
Short variant of SaveAs method.
Declaration
public void SaveAs(string FileName, ExcelSaveType saveType, ExcelVersion version)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | FileName | Name of the file into which workbook will be saved. |
| ExcelSaveType | saveType | Options for save. |
| ExcelVersion | version | Excel version that should be used. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | When FileName is NULL. |
| System.ArgumentException | When FileName is empty. |
SaveAs(String, ExcelSaveType, HttpResponse)
Save changes to the specified HttpResponse based on ExcelSaveType.
Declaration
public void SaveAs(string fileName, ExcelSaveType saveType, HttpResponse response)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| ExcelSaveType | saveType | Type of the Excel file. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xls");
workbook.SaveAs("Output.xls", ExcelSaveType.SaveAsXLS, Response);
SaveAs(String, ExcelSaveType, HttpResponse, ExcelDownloadType)
Save changes to the specified HttpResponse based on ExcelSaveType and ExcelDownloadType.
Declaration
public void SaveAs(string fileName, ExcelSaveType saveType, HttpResponse response, ExcelDownloadType downloadType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| ExcelSaveType | saveType | Type of the Excel file. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelDownloadType | downloadType | Download type. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xls");
workbook.SaveAs("Output.xls", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog);
SaveAs(String, ExcelSaveType, HttpResponse, ExcelDownloadType, ExcelHttpContentType)
Save changes to the specified HttpResponse based on ExcelSaveType,ExcelDownloadType and ExcelHttpContentType.
Declaration
public void SaveAs(string fileName, ExcelSaveType saveType, HttpResponse response, ExcelDownloadType downloadType, ExcelHttpContentType contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| ExcelSaveType | saveType | Type of the Excel file. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelDownloadType | downloadType | Download type. |
| ExcelHttpContentType | contentType | Content type to use. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xls");
workbook.SaveAs("Output.xls", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.Excel97);
SaveAs(String, ExcelSaveType, HttpResponse, ExcelHttpContentType)
Save changes to the specified HttpResponse based on ExcelSaveType and ExcelHttpContentType.
Declaration
public void SaveAs(string fileName, ExcelSaveType saveType, HttpResponse response, ExcelHttpContentType contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| ExcelSaveType | saveType | Type of the Excel file. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelHttpContentType | contentType | Content type to use. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xls");
workbook.SaveAs("Output.xls", ExcelSaveType.SaveAsXLS, Response, ExcelHttpContentType.Excel97);
SaveAs(String, String)
Saves workbook with specified file name using separator. Used only for CSV files.
Declaration
public void SaveAs(string fileName, string separator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Path to save. |
| System.String | separator | Denotes separator for the CSV file types. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code snippet illustrates how to save as CSV.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SaveAs("Output.csv", ",");
SaveAs(String, String, Encoding)
Saves workbook with specified file name with given separator and encoding. Used only for CSV files.
Declaration
public void SaveAs(string fileName, string separator, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Path to save the CSV file. |
| System.String | separator | Denotes separator for the CSV file types. |
| System.Text.Encoding | encoding | The name of a character encoding that is supported by the .NET Framework. |
Remarks
This overloaded method can be used to apply encoding to the CSV file in particular. The default encoding type is UTF-8. Other encoding types include ASCII, UTF-7, and UTF-32. This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
using(ExcelEngine engine = new ExcelEngine())
{
IApplication application = engine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
worksheet["A1"].Text = "This";
worksheet["B1"].Text = "is";
worksheet["C1"].Text = "a";
worksheet["D1"].Text = "sample";
worksheet["E1"].Text = "to";
worksheet["F1"].Text = "set";
worksheet["G1"].Text = "encoding";
workbook.SaveAs("Output.csv", ",",Encoding.Unicode);
}
SaveAs(String, String, HttpResponse, ExcelDownloadType, ExcelHttpContentType)
Save changes to the specified HttpResponse,using separator with the specified ExcelDownloadType and ExcelHttpContentType.
Declaration
public void SaveAs(string fileName, string separator, HttpResponse response, ExcelDownloadType downloadType, ExcelHttpContentType contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| System.String | separator | Denotes separator for the CSV file types. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelDownloadType | downloadType | Download type. |
| ExcelHttpContentType | contentType | Http content type. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SaveAs("Output.csv", ",", Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.CSV);
SaveAs(String, String, HttpResponse, ExcelDownloadType, ExcelHttpContentType, Encoding)
Save changes to the specified HttpResponse,using separator and encoding with the specified ExcelDownloadType and ExcelHttpContentType.
Declaration
public void SaveAs(string fileName, string separator, HttpResponse response, ExcelDownloadType downloadType, ExcelHttpContentType contentType, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| System.String | separator | Denotes separator for the CSV file types. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelDownloadType | downloadType | Enumeration to specify the download type. |
| ExcelHttpContentType | contentType | Enumeration to specify the Http content type. |
| System.Text.Encoding | encoding | The name of a character encoding that is supported by the .NET Framework. |
Remarks
This overloaded method can be used to apply encoding to the CSV file in particular. The default encoding type is UTF-8. Other encoding types include ASCII, UTF-7, and UTF-32. This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
using(ExcelEngine engine = new ExcelEngine())
{
IApplication application = engine.Excel;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
worksheet["A1"].Text = "This";
worksheet["B1"].Text = "is";
worksheet["C1"].Text = "a";
worksheet["D1"].Text = "sample";
worksheet["E1"].Text = "to";
worksheet["F1"].Text = "set";
worksheet["G1"].Text = "encoding";
workbook.SaveAs("Output.csv", ",", Response, ExcelDownloadType.PromptDialog, ExcelHttpContentType.CSV, Encoding.UTF7);
}
SaveAs(String, HttpResponse)
Saves changes to the specified HttpResponse.
Declaration
public void SaveAs(string fileName, HttpResponse response)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| System.Web.HttpResponse | response | HttpResponse to save in. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
SaveAs(String, HttpResponse, ExcelDownloadType)
Save changes to the specified HttpResponse based on ExcelDownloadType.
Declaration
public void SaveAs(string fileName, HttpResponse response, ExcelDownloadType downloadType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelDownloadType | downloadType | Download type. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xls");
workbook.SaveAs("Output.xls", Response, ExcelDownloadType.PromptDialog);
SaveAs(String, HttpResponse, ExcelDownloadType, ExcelHttpContentType)
Saves changes to the specified HttpResponse based on download type and content type.
Declaration
public void SaveAs(string fileName, HttpResponse response, ExcelDownloadType downloadType, ExcelHttpContentType contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelDownloadType | downloadType | Download type. |
| ExcelHttpContentType | contentType | Content type to use. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
SaveAs(String, HttpResponse, ExcelHttpContentType)
Save changes to the specified HttpResponse based on ExcelDownloadType and ExcelHttpContentType.
Declaration
public void SaveAs(string fileName, HttpResponse response, ExcelHttpContentType contentType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | Name of the file in HttpResponse. |
| System.Web.HttpResponse | response | HttpResponse that will receive workbook's data. |
| ExcelHttpContentType | contentType | Content type to use. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xls");
workbook.SaveAs("Output.xls", Response, ExcelHttpContentType.Excel97);
SaveAsHtml(Stream)
Saves as Html to the specified stream.
Declaration
public void SaveAsHtml(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | stream that will receive html data. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code snippets illustrates how to save as html to the specified stream.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
Stream stream = new MemoryStream();
workbook.SaveAsHtml(stream);
SaveAsHtml(Stream, HtmlSaveOptions)
Saves as Html to the specified stream based on HtmlSaveOptions.
Declaration
public void SaveAsHtml(Stream stream, HtmlSaveOptions saveOption)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | stream that will receive html data. |
| HtmlSaveOptions | saveOption |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code snippets illustrates how to save as html to the specified stream.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
Stream stream = new MemoryStream();
workbook.SaveAsHtml(stream,HtmlSaveOptions.Default);
SaveAsHtml(String, HtmlSaveOptions)
Saves as Html to specified file name based on ExcelSaveType.
Declaration
public void SaveAsHtml(string fileName, HtmlSaveOptions saveOption)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | |
| HtmlSaveOptions | saveOption |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code snippets illustrates how to save as html to the specified file name.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SaveAsHtml("Output.html",HtmlSaveOptions.Default);
SaveAsJson(Stream)
Saves the workbook to a JSON file stream.
Declaration
public void SaveAsJson(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to save into. |
SaveAsJson(Stream, IRange)
Saves the range to a JSON file stream.
Declaration
public void SaveAsJson(Stream stream, IRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to save into. |
| IRange | range | Range to save as JSON. |
SaveAsJson(Stream, IRange, Boolean)
Saves the range to a JSON file stream as schema.
Declaration
public void SaveAsJson(Stream stream, IRange range, bool isSchema)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to save into. |
| IRange | range | Range to save as JSON. |
| System.Boolean | isSchema |
SaveAsJson(Stream, IWorksheet)
Saves the worksheet to a JSON file stream.
Declaration
public void SaveAsJson(Stream stream, IWorksheet worksheet)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | |
| IWorksheet | worksheet |
SaveAsJson(Stream, IWorksheet, Boolean)
Saves the worksheet to a JSON file stream as schema.
Declaration
public void SaveAsJson(Stream stream, IWorksheet worksheet, bool isSchema)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | |
| IWorksheet | worksheet | |
| System.Boolean | isSchema |
SaveAsJson(Stream, Boolean)
Saves the workbook to a JSON file stream as schema.
Declaration
public void SaveAsJson(Stream stream, bool isSchema)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to save into. |
| System.Boolean | isSchema |
SaveAsJson(String)
Saves the workbook to a JSON file.
Declaration
public void SaveAsJson(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName |
SaveAsJson(String, IRange)
Saves the range to a JSON file.
Declaration
public void SaveAsJson(string fileName, IRange range)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | |
| IRange | range | Range to save as JSON. |
SaveAsJson(String, IRange, Boolean)
Saves the range to a JSON file as schema.
Declaration
public void SaveAsJson(string fileName, IRange range, bool isSchema)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | |
| IRange | range | Range to save as JSON. |
| System.Boolean | isSchema |
SaveAsJson(String, IWorksheet)
Saves the worksheet to a JSON file.
Declaration
public void SaveAsJson(string fileName, IWorksheet worksheet)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | |
| IWorksheet | worksheet |
SaveAsJson(String, IWorksheet, Boolean)
Saves the worksheet to a JSON file as schema.
Declaration
public void SaveAsJson(string fileName, IWorksheet worksheet, bool isSchema)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | |
| IWorksheet | worksheet | |
| System.Boolean | isSchema |
SaveAsJson(String, Boolean)
Saves the workbook to a JSON file as schema.
Declaration
public void SaveAsJson(string fileName, bool isSchema)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | fileName | |
| System.Boolean | isSchema |
SaveAsODS(String)
Converts XLS/XLSX file to ODS
Declaration
public void SaveAsODS(string FileName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | FileName |
SaveAsXml(Stream, ExcelXmlSaveType)
Saves workbook as stream with specified ExcelXmlSaveType.
Declaration
public void SaveAsXml(Stream stream, ExcelXmlSaveType saveType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.Stream | stream | Stream to save into. |
| ExcelXmlSaveType | saveType | Xml save type. |
Remarks
This method is supported on Windows Forms, WPF, ASP.NET and ASP.NET MVC platforms only.
Examples
The following code snippet illustrates how to save the stream as Xml.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
Stream stream = new MemoryStream();
workbook.SaveAsXml(stream, ExcelXmlSaveType.MSExcel);
SaveAsXml(String, ExcelXmlSaveType)
Saves workbook with the specified file name and ExcelXmlSaveType.
Declaration
public void SaveAsXml(string strFileName, ExcelXmlSaveType saveType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | strFileName | File name to save into. |
| ExcelXmlSaveType | saveType | Xml save type. |
Remarks
This method is not supported in WinRT, Windows Phone, Universal and Portable platforms.
Examples
The following code snippet illustrates how to save as Xml.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SaveAsXml("Output.xml", ExcelXmlSaveType.MSExcel);
SaveAsXml(XmlWriter, ExcelXmlSaveType)
Saves workbook in xml format with the specifiedExcelXmlSaveType.
Declaration
public void SaveAsXml(XmlWriter writer, ExcelXmlSaveType saveType)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Xml.XmlWriter | writer | XmlWriter to save into. |
| ExcelXmlSaveType | saveType | Xml save type. |
Examples
The following code snippet illustrates how to save as Xml using Xml writer.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
System.Xml.XmlWriter writer = System.Xml.XmlWriter.Create("Output.xml");
workbook.SaveAsXml(writer, ExcelXmlSaveType.MSExcel);
SerializeForClipboard(OffsetArrayList, WorksheetImpl)
Serialize workbook for the clipboard.
Declaration
[CLSCompliant(false)]
protected void SerializeForClipboard(OffsetArrayList records, WorksheetImpl sheet)
Parameters
| Type | Name | Description |
|---|---|---|
| OffsetArrayList | records | Record's list to serialize into. |
| WorksheetImpl | sheet | Worksheet to serialize. |
SetActiveWorksheet(WorksheetBaseImpl)
Sets active worksheet.
Declaration
public void SetActiveWorksheet(WorksheetBaseImpl sheet)
Parameters
| Type | Name | Description |
|---|---|---|
| WorksheetBaseImpl | sheet | Worksheet that will be activated. |
SetChanged()
Sets Saved flag to the False state.
Declaration
public void SetChanged()
SetColorOrGetNearest(Color)
Sets the color or Gets nearest color.
Declaration
public ExcelKnownColors SetColorOrGetNearest(Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Drawing.Color | color | System color |
Returns
| Type | Description |
|---|---|
| ExcelKnownColors | Color index from workbook palette. |
Remarks
If there is at least one free color, define a new color; if not, search for the closest one to the specified Color structure from Workbook palette.
Examples
The following code snippets illustrates how to set color or get nearest color.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SetColorOrGetNearest(System.Drawing.Color.Aqua);
SetColorOrGetNearest(Int32, Int32, Int32)
Sets the color or Gets nearest color with the specified red, green and blue color value.
Declaration
public ExcelKnownColors SetColorOrGetNearest(int r, int g, int b)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | r | Red component of the color. |
| System.Int32 | g | Green component of the color. |
| System.Int32 | b | Blue component of the color. |
Returns
| Type | Description |
|---|---|
| ExcelKnownColors | Color index from workbook palette. |
Remarks
If there is at least one free color, define a new color; if not, search for the closest one to the specified by red, green, and blue values color from Workbook palette.
Examples
The following code snippet illustrates how to set color or get nearest color by red,green and blue.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SetColorOrGetNearest(123,45,56);
SetPaletteColor(Int32, Color)
Sets the palette color for the given index.
Declaration
public void SetPaletteColor(int index, Color color)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | index | Index of Color in array. |
| System.Drawing.Color | color | New color which must be set. |
Examples
The following code snippet illustrates how to set palette color.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SetPaletteColor(0, System.Drawing.Color.Aqua);
SetSeparators(Char, Char)
Sets separators for formula parsing.
Declaration
public void SetSeparators(char argumentsSeparator, char arrayRowsSeparator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Char | argumentsSeparator | Arguments separator to set. |
| System.Char | arrayRowsSeparator | Array rows separator to set. |
Examples
The following code illustrates how to set separators.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SetSeparators(',', ';');
SetWriteProtectionPassword(String)
Sets write protection for workbook using password.
Declaration
public void SetWriteProtectionPassword(string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | password | Password to set. |
Examples
The following code snippet illustrates how to set write protection password.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
workbook.SetWriteProtectionPassword("Password");
Sqr(Double)
Raises argument to the second power.
Declaration
protected double Sqr(double value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | value | Value to be squared. |
Returns
| Type | Description |
|---|---|
| System.Double | Squared value. |
Unprotect()
Unprotects workbook.
Declaration
public void Unprotect()
Examples
The following code illustrates how to unprotect a workbook.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Unprotects the password.
workbook.Unprotect();
Unprotect(String)
Unprotects workbook using password.
Declaration
public void Unprotect(string password)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | password | Password to unprotect workbook. |
Remarks
Throws ArgumentOutOfRangeException when password is wrong.
Examples
The following code illustrates how to unprotect a workbook using password.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Unprotects the password using password.
workbook.Unprotect("Password");
UpdateActiveSheetAfterMove(Int32, Int32)
Updates active sheet index after move operation.
Declaration
protected void UpdateActiveSheetAfterMove(int iOldIndex, int iNewIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iOldIndex | Old sheet index. |
| System.Int32 | iNewIndex | New sheet index. |
UpdateFormula(IRange, IRange)
Declaration
public void UpdateFormula(IRange sourceRange, IRange destRange)
Parameters
| Type | Name | Description |
|---|---|---|
| IRange | sourceRange | |
| IRange | destRange |
UpdateFormula(Int32, Rectangle, Int32, Rectangle)
Declaration
public void UpdateFormula(int iSourceIndex, Rectangle rectSource, int iDestIndex, Rectangle rectDest)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | iSourceIndex | |
| System.Drawing.Rectangle | rectSource | |
| System.Int32 | iDestIndex | |
| System.Drawing.Rectangle | rectDest |
UpdateNamedRangeIndexes(IDictionary<Int32, Int32>)
Updates index of all named ranges.
Declaration
public void UpdateNamedRangeIndexes(IDictionary<int, int> dicNewIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.IDictionary<System.Int32, System.Int32> | dicNewIndex | Key - old index, value - new index. |
UpdateNamedRangeIndexes(Int32[])
Declaration
public void UpdateNamedRangeIndexes(int[] arrNewIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32[] | arrNewIndex |
UpdatePivotCachesAfterInsertRemove(WorksheetImpl, Int32, Int32, Boolean, Boolean)
Updates pivot caches after insert.
Declaration
public void UpdatePivotCachesAfterInsertRemove(WorksheetImpl worksheet, int index, int count, bool isRow, bool isRemove)
Parameters
| Type | Name | Description |
|---|---|---|
| WorksheetImpl | worksheet | Worksheet where insert operation took place. |
| System.Int32 | index | |
| System.Int32 | count | |
| System.Boolean | isRow | |
| System.Boolean | isRemove | Indicates whether this is remove operation. |
UpdateStringIndexes(List<Int32>)
Updates string indexes.
Declaration
public void UpdateStringIndexes(List<int> arrNewIndexes)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Collections.Generic.List<System.Int32> | arrNewIndexes | List with new indexes. |
UpdateXFIndexes(Int32)
Updates indexes in all records accordingly to the new maximum count property.
Declaration
public void UpdateXFIndexes(int maxCount)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | maxCount | New value of maximum possible XF index. |
WidthToFileWidth(Double)
Converts column width in characters into column width in file.
Declaration
public double WidthToFileWidth(double width)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | width | Column width in characters. |
Returns
| Type | Description |
|---|---|
| System.Double | Column width in file. |
Events
OnFileSaved
This event is fired after workbook is successfully saved.
Declaration
public event EventHandler OnFileSaved
Event Type
| Type | Description |
|---|---|
| System.EventHandler |
OnReadOnlyFile
This event is fired when user tries to save into read-only file.
Declaration
public event ReadOnlyFileEventHandler OnReadOnlyFile
Event Type
| Type | Description |
|---|---|
| ReadOnlyFileEventHandler |
Explicit Interface Implementations
IWorkbook.PivotCaches
Returns collection of workbook pivot caches. Read-only.
Declaration
IPivotCaches IWorkbook.PivotCaches { get; }
Returns
| Type | Description |
|---|---|
| IPivotCaches |