Interface IParameters
Represents a collection of parameters collection.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.NET.dll
Syntax
public interface IParameters : IParentApplication, IEnumerable
Properties
Count
Gets the number of parameters in the query table. Read-only.
Declaration
int Count { get; }
Property Value
| Type |
|---|
| int |
Examples
Count returns the number of conditions applied. Here for example, we check Count value before and after applying three conditions.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save and Dispose.
workbook.SaveAs("QueryTables.xlsx");
workbook.Close();
}
//Output will be
//3
this[int]
Gets a parameter of the specified index from the collection. Read-only.
Declaration
IParameter this[int index] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| int | index |
Property Value
| Type |
|---|
| IParameter |
Examples
The following code illustrates how to access the first condition from IParameter.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save and Dispose.
workbook.SaveAs("QueryTables.xlsx");
workbook.Close();
}
Methods
Add(string, ExcelParameterDataType)
Adds a parameter to the collection.
Declaration
IParameter Add(string name, ExcelParameterDataType dataType)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| ExcelParameterDataType | dataType |
Returns
| Type | Description |
|---|---|
| IParameter | Returns the newly added IParameter instance. |
Examples
To add a condition to the parameter we use IParameter.Add method. It adds and returns a new parameter object, that we can use to set and get parameter and properties.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save and Dispose.
workbook.SaveAs("QueryTables.xlsx");
workbook.Close();
}
RemoveAt(int)
Removes the parameter from the collection.
Declaration
void RemoveAt(int index)
Parameters
| Type | Name | Description |
|---|---|---|
| int | index | Index of the parameter to be removed. |
Examples
The following code illustrates how to remove a particular condition from the parameter collection.
using (ExcelEngine excelEngine = new ExcelEngine())
{
//Create a worksheet.
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
//Save and Dispose.
workbook.SaveAs("QueryTables.xlsx");
workbook.Close();
}