Class WorkbookImpl
This class represents an Excel Workbook.
Inherited Members
Namespace: Syncfusion.XlsIO.Implementation
Assembly: Syncfusion.XlsIO.UWP.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, 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 |
---|
System.String |
DEF_FIRST_USER_COLOR
First user-defined color.
Declaration
public const int DEF_FIRST_USER_COLOR = 8
Field Value
Type |
---|
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 |
---|
IWorksheet |
ActiveSheetIndex
Gets or sets index of the active sheet.
Declaration
public int ActiveSheetIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
AddInFunctions
Gets collection of add-in functions. Read-only.
Declaration
public IAddInFunctions AddInFunctions { get; }
Property Value
Type |
---|
IAddInFunctions |
AlgorithmName
Alogrithm name to protect/unprotect workbook.
Declaration
public string AlgorithmName { get; set; }
Property Value
Type |
---|
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 |
---|
System.Boolean |
ArgumentsSeparator
Gets the formula arguments separator.
Declaration
public string ArgumentsSeparator { get; }
Property Value
Type |
---|
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 |
---|
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 |
---|
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 |
---|
IBuiltInDocumentProperties |
CalculationOptions
Gets calculation options. Read-only.
Declaration
public ICalculationOptions CalculationOptions { get; }
Property Value
Type |
---|
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 |
---|
ICharts |
CheckCompability
Specifies wheather the workbook checks the Compability of earlier version
Declaration
public bool CheckCompability { get; set; }
Property Value
Type |
---|
System.Boolean |
CodeName
Name which used by macros to access to workbook items.
Declaration
public string CodeName { get; set; }
Property Value
Type |
---|
System.String |
Connections
Gets the workbook connections. Read Only
Declaration
public IConnections Connections { get; }
Property Value
Type |
---|
IConnections |
Examples
The following code snippet illustrates how to get the connections from the workbook.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
IWorkbook workbook = application.Workbooks.Open("Sample.xlsx");
//Gets the workbook connections.
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 |
---|
IMetaProperties |
ControlsStream
Gets value indicating whether workbook controls stream or not. Read-only.
Declaration
public Stream ControlsStream { get; }
Property Value
Type |
---|
System.IO.Stream |
CurrentHeaderId
First free shape id.
Declaration
public int CurrentHeaderId { get; set; }
Property Value
Type |
---|
System.Int32 |
CurrentObjectId
Declaration
public int CurrentObjectId { get; set; }
Property Value
Type |
---|
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 |
---|
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 |
---|
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 |
---|
FileDataHolder |
Date1904
True if the workbook uses the 1904 date system.
Declaration
public bool Date1904 { get; set; }
Property Value
Type |
---|
System.Boolean |
DefaultThemeVersion
Indicates default theme version for wokbook
Declaration
public string DefaultThemeVersion { get; set; }
Property Value
Type |
---|
System.String |
DefaultXFIndex
Returns index to the default extended format.
Declaration
public int DefaultXFIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
DeletedConnections
Deleted connections
Declaration
public IConnections DeletedConnections { get; }
Property Value
Type |
---|
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 |
---|
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 |
---|
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 |
---|
System.Int32 |
DisplayWorkbookTabs
True if the tabs are visible. otherwise False.
Declaration
public bool DisplayWorkbookTabs { get; set; }
Property Value
Type |
---|
System.Boolean |
ExternWorkbooks
Returns collection of external workbooks.
Declaration
public ExternBookCollection ExternWorkbooks { get; }
Property Value
Type |
---|
ExternBookCollection |
FirstCharSize
Declaration
public int FirstCharSize { get; set; }
Property Value
Type |
---|
System.Int32 |
FormulaUtil
Returns class for formula parsing. Read-only.
Declaration
public FormulaUtil FormulaUtil { get; }
Property Value
Type |
---|
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 |
---|
System.String |
HasDuplicatedNames
Indicates whether original file contains duplicated external names.
Declaration
public bool HasDuplicatedNames { get; set; }
Property Value
Type |
---|
System.Boolean |
HashValue
Hash value to ensure the workbook protected password.
Declaration
public byte[] HashValue { get; set; }
Property Value
Type |
---|
System.Byte[] |
HasMacros
True if workbook contains Vba macros. Read-only.
Declaration
public bool HasMacros { get; }
Property Value
Type |
---|
System.Boolean |
HeaderFooterData
Returns data that is shared by all header/footers.
Declaration
public WorkbookShapeDataImpl HeaderFooterData { get; }
Property Value
Type |
---|
WorkbookShapeDataImpl |
HeapHandle
Declaration
public IntPtr HeapHandle { get; }
Property Value
Type |
---|
System.IntPtr |
HidePivotFieldList
Indicates whether pivot table fields option is hidden or not.
Declaration
public bool HidePivotFieldList { get; set; }
Property Value
Type |
---|
System.Boolean |
InnerAddInFunctions
Returns collection of add-in functions. Read-only.
Declaration
public AddInFunctionsCollection InnerAddInFunctions { get; }
Property Value
Type |
---|
AddInFunctionsCollection |
InnerCalculation
Returns calculation options. Read-only.
Declaration
public CalculationOptionsImpl InnerCalculation { get; }
Property Value
Type |
---|
CalculationOptionsImpl |
InnerCharts
Charts collection.
Declaration
protected ChartsCollection InnerCharts { get; }
Property Value
Type |
---|
ChartsCollection |
InnerContentTypeProperties
Return ContententType Properties from the workbook
Declaration
public MetaPropertiesImpl InnerContentTypeProperties { get; }
Property Value
Type |
---|
MetaPropertiesImpl |
InnerCustomXmlParts
Return CustomXmlParts from the workbook
Declaration
public CustomXmlPartCollection InnerCustomXmlParts { get; }
Property Value
Type |
---|
CustomXmlPartCollection |
InnerExtFormatRecords
Declaration
protected List<ExtendedFormatRecord> InnerExtFormatRecords { get; }
Property Value
Type |
---|
System.Collections.Generic.List<ExtendedFormatRecord> |
InnerExtFormats
Collection of all ExtendedFormats used in the workbook.
Declaration
public ExtendedFormatsCollection InnerExtFormats { get; }
Property Value
Type |
---|
ExtendedFormatsCollection |
InnerFonts
Collection of all fonts used in the workbook. Read-only.
Declaration
public FontsCollection InnerFonts { get; }
Property Value
Type |
---|
FontsCollection |
InnerFormats
Collection of all formats used in the workbook. Read-only.
Declaration
public FormatsCollection InnerFormats { get; }
Property Value
Type |
---|
FormatsCollection |
InnerNamesColection
Return WorkbookNamesColection from parent WorkBook.
Declaration
public WorkbookNamesCollection InnerNamesColection { get; }
Property Value
Type |
---|
WorkbookNamesCollection |
InnerPalette
Returns internal array with palette colors. Read-only.
Declaration
public List<Color> InnerPalette { get; }
Property Value
Type |
---|
System.Collections.Generic.List<Windows.UI.Color> |
InnerSST
SSTDictionary that contains all strings used in the workbook. Read-only.
Declaration
public SSTDictionary InnerSST { get; }
Property Value
Type |
---|
SSTDictionary |
InnerStyles
Declaration
protected StylesCollection InnerStyles { get; }
Property Value
Type |
---|
StylesCollection |
InnerWorksheetGroup
Returns grouped worksheets. Read-only.
Declaration
public WorksheetGroup InnerWorksheetGroup { get; }
Property Value
Type |
---|
WorksheetGroup |
InnerWorksheets
Worksheets collection.
Declaration
protected WorksheetsCollection InnerWorksheets { get; }
Property Value
Type |
---|
WorksheetsCollection |
InnerXFExtRecords
Declaration
protected List<ExtendedXFRecord> InnerXFExtRecords { get; }
Property Value
Type |
---|
System.Collections.Generic.List<ExtendedXFRecord> |
IsCellProtection
True if cells are protected. Read-only.
Declaration
public bool IsCellProtection { get; }
Property Value
Type |
---|
System.Boolean |
IsHScrollBarVisible
Gets/Sets value to display horizontal scrollbar
Declaration
public bool IsHScrollBarVisible { get; set; }
Property Value
Type |
---|
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 |
---|
System.Boolean |
IsRightToLeft
Indicates whether worksheet is displayed right to left.
Declaration
public bool IsRightToLeft { get; set; }
Property Value
Type |
---|
System.Boolean |
IsVScrollBarVisible
Gets/Sets value to display vertical scrollbar
Declaration
public bool IsVScrollBarVisible { get; set; }
Property Value
Type |
---|
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 |
---|
System.Boolean |
Loading
Indicates whether workbook is loading. Read-only.
Declaration
public bool Loading { get; set; }
Property Value
Type |
---|
System.Boolean |
MaxColumnCount
Gets maximum column count for each worksheet in the workbook. Read-only.
Declaration
public int MaxColumnCount { get; }
Property Value
Type |
---|
System.Int32 |
MaxDigitWidth
Declaration
public double MaxDigitWidth { get; }
Property Value
Type |
---|
System.Double |
MaxImportColumns
Maximum columns to import
Declaration
public int MaxImportColumns { get; set; }
Property Value
Type |
---|
System.Int32 |
MaxIndent
Gets maximum possible indent value. Read-only.
Declaration
public int MaxIndent { get; }
Property Value
Type |
---|
System.Int32 |
MaxRowCount
Gets maximum row count for each worksheet in the workbook. Read-only.
Declaration
public int MaxRowCount { get; }
Property Value
Type |
---|
System.Int32 |
MaxTableIndex
Gets or sets maximum used table (list object) index.
Declaration
public int MaxTableIndex { get; set; }
Property Value
Type |
---|
System.Int32 |
MaxXFCount
Gets maximum possible number of extended formats. Read-only.
Declaration
public int MaxXFCount { get; }
Property Value
Type |
---|
System.Int32 |
Names
Gets Names collection.
Declaration
public INames Names { get; }
Property Value
Type |
---|
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 |
---|
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 |
---|
Syncfusion.XlsIO.Implementation.Collections.WorkbookObjectsCollection |
Palette
Declaration
public Color[] Palette { get; }
Property Value
Type |
---|
Windows.UI.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 |
---|
Windows.UI.Color[] |
PasswordRev4
Declaration
protected PasswordRev4Record PasswordRev4 { get; set; }
Property Value
Type |
---|
PasswordRev4Record |
PasswordToOpen
Gets or sets password to encrypt document.
Declaration
public string PasswordToOpen { get; set; }
Property Value
Type |
---|
System.String |
PivotCaches
Gets pivot caches collection. Read-only.
Declaration
public PivotCacheCollection PivotCaches { get; }
Property Value
Type |
---|
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 |
---|
System.Boolean |
ProtectionRev4
Declaration
protected ProtectionRev4Record ProtectionRev4 { get; set; }
Property Value
Type |
---|
ProtectionRev4Record |
ReadOnly
True if the workbook has been opened as Read-only. Read-only Boolean.
Declaration
public bool ReadOnly { get; }
Property Value
Type |
---|
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 |
---|
System.Boolean |
RowSeparator
Gets or sets row separator for array parsing.
Declaration
public string RowSeparator { get; }
Property Value
Type |
---|
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 |
---|
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 |
---|
System.Boolean |
Saving
Indicates whether workbook is in saving process. Read-only.
Declaration
public bool Saving { get; }
Property Value
Type |
---|
System.Boolean |
SecondCharSize
Declaration
public int SecondCharSize { get; set; }
Property Value
Type |
---|
System.Int32 |
ShapesData
Returns data that is shared by all shapes (global options, unique pictures, etc. ).
Declaration
public WorkbookShapeDataImpl ShapesData { get; }
Property Value
Type |
---|
WorkbookShapeDataImpl |
SpinCount
Spin count to loop the hash algorithm.
Declaration
public uint SpinCount { get; set; }
Property Value
Type |
---|
System.UInt32 |
StandardFont
Gets or sets the name of the standard font.
Declaration
public string StandardFont { get; set; }
Property Value
Type |
---|
System.String |
StandardFontSize
Gets or sets the standard font size.
Declaration
public double StandardFontSize { get; set; }
Property Value
Type |
---|
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 |
---|
System.Double |
StandardRowHeightInPixels
Gets or sets row height in pixels
Declaration
public int StandardRowHeightInPixels { get; set; }
Property Value
Type |
---|
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 |
---|
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 |
---|
ITableStyles |
TabSheets
Gets collection with all tabsheets in the workbook. Read-only.
Declaration
public ITabSheets TabSheets { get; }
Property Value
Type |
---|
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 |
---|
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 |
---|
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 |
---|
IVbaProject |
Version
Gets / sets excel version.
Declaration
public ExcelVersion Version { get; set; }
Property Value
Type |
---|
ExcelVersion |
WindowOne
Stores the attributes of the workbook window. Read-only.
Declaration
public WindowOneRecord WindowOne { get; }
Property Value
Type |
---|
WindowOneRecord |
WorksheetGroup
Gets grouped worksheets. Read-only.
Declaration
public IWorksheetGroup WorksheetGroup { get; }
Property Value
Type |
---|
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 |
---|
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;
Methods
Activate()
Activates the first window associated with the workbook.
Declaration
public void Activate()
add_OnReadOnlyFile(ReadOnlyFileEventHandler)
Declaration
public void add_OnReadOnlyFile(ReadOnlyFileEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyFileEventHandler | value |
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");
ColorDistance(Color, Color)
Calculates distance between two colors.
Declaration
protected double ColorDistance(Color color1, Color color2)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.Color | color1 | First color. |
Windows.UI.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 |
---|
System.Boolean |
CopyExternSheets(ExternSheetRecord, Dictionary<Int32, Int32>)
Copies externsheets to to another workbook.
Declaration
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. |
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. |
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 override void Finalize()
Overrides
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
protected ExtendedFormatRecord GetDefaultXF(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Returns
Type |
---|
ExtendedFormatRecord |
GetDefaultXFExt()
Declaration
protected ExtendedXFRecord GetDefaultXFExt()
Returns
Type |
---|
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 |
---|
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. |
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. |
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. |
GetNearestColor(Color)
Gets the nearest color with the specified Color structure from Workbook palette.
Declaration
public ExcelKnownColors GetNearestColor(Color color)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.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 |
---|---|---|
Windows.UI.Color | color | Color to look for. |
System.Int32 | iStartIndex | Start index. |
Returns
Type | Description |
---|---|
ExcelKnownColors | 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 |
---|---|
Windows.UI.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 |
---|
Windows.UI.Color |
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 |
---|
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
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
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. |
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. |
remove_OnReadOnlyFile(ReadOnlyFileEventHandler)
Declaration
public void remove_OnReadOnlyFile(ReadOnlyFileEventHandler value)
Parameters
Type | Name | Description |
---|---|---|
ReadOnlyFileEventHandler | value |
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
public void RemoveExtenededFormatIndex(int xfIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | xfIndex | Index to the extended format to remove. |
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();
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);
}
SaveAsAsync(Stream)
Saves changes to the specified stream.
Declaration
public Task<bool> SaveAsAsync(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream that will receive workbook data. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsAsync(Stream, ExcelSaveType)
Saves changes to the specified stream.
Declaration
public Task<bool> SaveAsAsync(Stream stream, ExcelSaveType saveType)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream that will receive workbook data. |
ExcelSaveType | saveType | Save type. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsAsync(Stream, String)
Saves active Worksheet.
Declaration
public Task<bool> SaveAsAsync(Stream stream, string separator)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save int. |
System.String | separator | Separator to use. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsAsync(Stream, String, Encoding)
Saves workbook as stream with given separator and encoding. Used only for CSV files.
Declaration
public Task<bool> SaveAsAsync(Stream stream, string separator, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save the CSV file. |
System.String | separator | Denotes the separator to use in the CSV file. |
System.Text.Encoding | encoding | The name of a character encoding that is supported by the .NET Framework. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
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 Syncfusion.XlsIO;
using System.Text;
class Example
{
async void OnClick(object sender, RoutedEventArgs e)
{
using(ExcelEngine engine = new ExcelEngine())
{
IApplication application = excelEngine.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";
MemoryStream stream = new MemoryStream();
await workbook.SaveAsAsync(outputStream, ",", Encoding.UTF7);
}
}
}
SaveAsAsync(StorageFile)
Saves changes to the specified storage.
Declaration
public Task<bool> SaveAsAsync(StorageFile storageFile)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage that will receive workbook data. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsAsync(StorageFile, ExcelSaveType)
Saves changes to the specified storage file.
Declaration
public Task<bool> SaveAsAsync(StorageFile storageFile, ExcelSaveType saveType)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage File that will receive workbook data. |
ExcelSaveType | saveType | Save type. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsAsync(StorageFile, String)
Saves active Worksheet.
Declaration
public Task<bool> SaveAsAsync(StorageFile storageFile, string separator)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage file to save in it. |
System.String | separator | Separator to use. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsAsync(StorageFile, String, Encoding)
Saves workbook as storage file with given separator and encoding. Used only for CSV files.
Declaration
public Task<bool> SaveAsAsync(StorageFile storageFile, string separator, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage file to be saved as CSV. |
System.String | separator | Denotes the separator to use in the CSV file. |
System.Text.Encoding | encoding | The name of a character encoding that is supported by the .NET Framework. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
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 Syncfusion.XlsIO;
using System.Text;
class Example
{
async void OnClick(object sender, RoutedEventArgs e)
{
StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile storageFile = await local.CreateFileAsync("Output.csv", CreationCollisionOption.ReplaceExisting);
using(ExcelEngine engine = new ExcelEngine())
{
IApplication application = excelEngine.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";
await workbook.SaveAsAsync(storageFile, ",", Encoding.UTF7);
}
}
}
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 |
SaveAsJsonAsync(Stream)
Save changes to the specified stream.
Declaration
public Task<bool> SaveAsJsonAsync(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save into. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(Stream, IRange)
Save changes to the specified stream.
Declaration
public Task<bool> SaveAsJsonAsync(Stream stream, IRange range)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save into. |
IRange | range | Range to save as JSON. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(Stream, IRange, Boolean)
Save changes to the specified stream.
Declaration
public Task<bool> SaveAsJsonAsync(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 |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(Stream, IWorksheet)
Save changes to the specified stream.
Declaration
public Task<bool> SaveAsJsonAsync(Stream stream, IWorksheet worksheet)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save into. |
IWorksheet | worksheet |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(Stream, IWorksheet, Boolean)
Save changes to the specified stream.
Declaration
public Task<bool> SaveAsJsonAsync(Stream stream, IWorksheet worksheet, bool isSchema)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save into. |
IWorksheet | worksheet | |
System.Boolean | isSchema |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(Stream, Boolean)
Save changes to the specified stream.
Declaration
public Task<bool> SaveAsJsonAsync(Stream stream, bool isSchema)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save into. |
System.Boolean | isSchema |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(StorageFile)
Saves changes to the specified storage file.
Declaration
public Task<bool> SaveAsJsonAsync(StorageFile storageFile)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage File that will receive workbook data. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(StorageFile, IRange)
Saves changes to the specified storage file.
Declaration
public Task<bool> SaveAsJsonAsync(StorageFile storageFile, IRange range)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage File that will receive workbook data. |
IRange | range | Range to save as JSON. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(StorageFile, IRange, Boolean)
Saves changes to the specified storage file.
Declaration
public Task<bool> SaveAsJsonAsync(StorageFile storageFile, IRange range, bool isSchema)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage File that will receive workbook data. |
IRange | range | Range to save as JSON. |
System.Boolean | isSchema |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(StorageFile, IWorksheet)
Saves changes to the specified storage file.
Declaration
public Task<bool> SaveAsJsonAsync(StorageFile storageFile, IWorksheet worksheet)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage File that will receive workbook data. |
IWorksheet | worksheet |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(StorageFile, IWorksheet, Boolean)
Saves changes to the specified storage file.
Declaration
public Task<bool> SaveAsJsonAsync(StorageFile storageFile, IWorksheet worksheet, bool isSchema)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage File that will receive workbook data. |
IWorksheet | worksheet | |
System.Boolean | isSchema |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsJsonAsync(StorageFile, Boolean)
Saves changes to the specified storage file.
Declaration
public Task<bool> SaveAsJsonAsync(StorageFile storageFile, bool isSchema)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage File that will receive workbook data. |
System.Boolean | isSchema |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
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);
SaveAsXml(StorageFile, ExcelXmlSaveType)
Saves workbook in xml format.
Declaration
public void SaveAsXml(StorageFile storageFile, ExcelXmlSaveType saveType)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | storage File to save into. |
ExcelXmlSaveType | saveType | Xml save type. |
Remarks
This method is not supported in Windows Phone, Portable and Silverlight platforms.
SaveAsXmlAsync(Stream, ExcelXmlSaveType)
Saves workbook in xml format.
Declaration
public Task<bool> SaveAsXmlAsync(Stream stream, ExcelXmlSaveType saveType)
Parameters
Type | Name | Description |
---|---|---|
System.IO.Stream | stream | Stream to save into. |
ExcelXmlSaveType | saveType | Xml save type. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsXmlAsync(XmlWriter, ExcelXmlSaveType)
Saves workbook in xml format.
Declaration
public Task<bool> SaveAsXmlAsync(XmlWriter writer, ExcelXmlSaveType saveType)
Parameters
Type | Name | Description |
---|---|---|
System.Xml.XmlWriter | writer | XmlWriter to save into. |
ExcelXmlSaveType | saveType | Xml save type. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SaveAsXmlAsync(StorageFile, ExcelXmlSaveType)
Saves workbook in xml format.
Declaration
public Task<bool> SaveAsXmlAsync(StorageFile storageFile, ExcelXmlSaveType saveType)
Parameters
Type | Name | Description |
---|---|---|
Windows.Storage.StorageFile | storageFile | Storage file to save into. |
ExcelXmlSaveType | saveType | Xml save type. |
Returns
Type |
---|
System.Threading.Tasks.Task<System.Boolean> |
SerializeForClipboard(OffsetArrayList, WorksheetImpl)
Serialize workbook for the clipboard.
Declaration
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(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);
SetColorOrGetNearest(Color)
Sets the color or Gets nearest color.
Declaration
public ExcelKnownColors SetColorOrGetNearest(Color color)
Parameters
Type | Name | Description |
---|---|---|
Windows.UI.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);
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. |
Windows.UI.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 | |
Rectangle | rectSource | |
System.Int32 | iDestIndex | |
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 |
---|
System.EventHandler |
OnReadOnlyFile
This event is fired when user tries to save into read-only file.
Declaration
public event ReadOnlyFileEventHandler OnReadOnlyFile
Event Type
Type |
---|
ReadOnlyFileEventHandler |
Explicit Interface Implementations
IWorkbook.PivotCaches
Returns collection of workbook pivot caches. Read-only.
Declaration
IPivotCaches IWorkbook.PivotCaches { get; }
Returns
Type |
---|
IPivotCaches |