Class ExcelConnection
Represents a connection to an external data source in a workbook.
Inherited Members
Namespace: OfficeOpenXml.Data.Connection
Assembly: EPPlus.dll
Syntax
public class ExcelConnection : DocumentPart<ExcelConnection>
Properties
AutoDelete
If the connection should be automatically deleted when all data features which use it are deleted.
Declaration
public bool AutoDelete { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
AutomaticRefreshInterval
Specifies the interval, in minutes, at which the connection is automatically refreshed. A value of 0 means that the connection is not automatically refreshed.
Declaration
public int AutomaticRefreshInterval { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Credentials
How the connection should handle credentials.
Declaration
public eCredential Credentials { get; set; }
Property Value
| Type | Description |
|---|---|
| eCredential |
DataModel
If the connection is a data model connection, this property contains data model specific properties.
Declaration
public ExcelConnectionDataModel DataModel { get; set; }
Property Value
| Type | Description |
|---|---|
| ExcelConnectionDataModel |
DatabaseProperties
Database specific properties for the connection. This property is null if the connection is not a database or olap connection.
Declaration
public ExcelDatabaseProperties DatabaseProperties { get; }
Property Value
| Type | Description |
|---|---|
| ExcelDatabaseProperties |
Description
A description of the connection.
Declaration
public string Description { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ExcludeFromRefreshAll
If the connection is not to be refreshed on Refresh All.
Declaration
public bool ExcludeFromRefreshAll { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Id
Gets or sets the unique identifier for the connection.
Declaration
public int Id { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
IsBackground
If the connection can be refreshed in the background.
Declaration
public bool IsBackground { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsDeleted
If the connection has been deleted.
Declaration
public bool IsDeleted { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
IsNew
If the connection has been refreshed for the first time
Declaration
public bool IsNew { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
KeepAlive
If true, the connection should be kept alive by the spreadsheet application.
Declaration
public bool KeepAlive { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
LastRefreshVersion
The version of the spreadsheet application when the connection was last refreshed.
Declaration
public int LastRefreshVersion { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
MinimumRefreshableVersion
The minimum version of the spreadsheet application that can refresh the connection.
Declaration
public int MinimumRefreshableVersion { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Name
Gets or sets the name associated with the connection. Each connection should have a unique name.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
OdcFile
The full external path to the ODC file from which the connection was created.
Declaration
public string OdcFile { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
OlapProperties
Olap specific properties for the connection. This property is null if the connection is not an olap connection.
Declaration
public ExcelConnectionOlapProperties OlapProperties { get; }
Property Value
| Type | Description |
|---|---|
| ExcelConnectionOlapProperties |
OnlyUseConnectionFile
If the spreadsheet application should always and only use the connection information in the external connection file indicated by the OdcFile when the connection is refreshed.
Declaration
public bool OnlyUseConnectionFile { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Parameters
Parameters for the connection.
Declaration
public ExcelConnectionParameters Parameters { get; }
Property Value
| Type | Description |
|---|---|
| ExcelConnectionParameters |
ReconnectionMethod
How the connection should reconnect when the connection fails
Declaration
public eReconnectionMethod ReconnectionMethod { get; set; }
Property Value
| Type | Description |
|---|---|
| eReconnectionMethod |
RefreshOnLoad
If the connection should be refreshed when the workbook is loaded.
Declaration
public bool RefreshOnLoad { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SaveData
If data fetched by the connection should be saved in the workbook. Default false.
Declaration
public bool SaveData { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SavePassword
If the password for the connection should be saved in the workbook. Default false.
Declaration
public bool SavePassword { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
SingleSignOnId
SSO id used for authentication for the connection.
Declaration
public string SingleSignOnId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
SourceDatabaseFile
Used when the external data source is file-based. When a connection to such a data source fails, the spreadsheet application attempts to connect directly to this file.Can be expressed in URI or system-specific file path notation.
Declaration
public string SourceDatabaseFile { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
TextProperties
Text specific properties for the connection. This property is null if the conenction is not a text connection.
Declaration
public ExcelTextProperties TextProperties { get; }
Property Value
| Type | Description |
|---|---|
| ExcelTextProperties |
Type
The type of data source for the connection.
- ODBC-based source
- DAO-based source
- ApplicationDefined
- Web query
- OLEDB-based source.
- Text-based source
- ADO-based source
- DSP-Document Source Provider 100-Data Model - OLEDB 101-Data Model - Data feed 102-Data Model - Worksheet Data 103-Data Model - Text data
Declaration
public eConnectionDataSourceType? Type { get; set; }
Property Value
| Type | Description |
|---|---|
| eConnectionDataSourceType? |
UsedByAddin
If the connection is used by an addin component and will not be deleted with any data feature that uses it.
Declaration
public bool UsedByAddin { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
WebProperties
Web specific properties for the connection. This property is null if the connection is not a web connection.
Declaration
public ExcelWebProperties WebProperties { get; }
Property Value
| Type | Description |
|---|---|
| ExcelWebProperties |