Interface IParameters
Represents a collection of parameters collection.
Inherited Members
Namespace: Syncfusion.XlsIO
Assembly: Syncfusion.XlsIO.Base.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 | Description |
---|---|
System.Int32 |
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
Item[Int32]
Gets a parameter of the specified index from the collection. Read-only.
Declaration
IParameter this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type | Description |
---|---|
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 |
---|---|---|
System.String | name | |
ExcelParameterDataType | dataType |
Returns
Type | Description |
---|---|
IParameter | Returns the newly added IParameter instance. |
Examples
To add a condition to the parameter we use
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(Int32)
Removes the parameter from the collection.
Declaration
void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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();
}