Class QueryTableCollection

QueryTableCollection class

A collection of QueryTableCollection objects that represent QueryTable collection information.

public class QueryTableCollection : CollectionBase<QueryTable>

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets the querytable by the specific index.
Item { get; set; }

Methods

NameDescription
BinarySearch(QueryTable)
BinarySearch(QueryTable, IComparer<QueryTable>)
BinarySearch(int, int, QueryTable, IComparer<QueryTable>)
Clear()
Contains(QueryTable)
CopyTo(QueryTable[])
CopyTo(QueryTable[], int)
CopyTo(int, QueryTable[], int, int)
Exists(Predicate<QueryTable>)
Find(Predicate<QueryTable>)
FindAll(Predicate<QueryTable>)
FindIndex(Predicate<QueryTable>)
FindIndex(int, Predicate<QueryTable>)
FindIndex(int, int, Predicate<QueryTable>)
FindLast(Predicate<QueryTable>)
FindLastIndex(Predicate<QueryTable>)
FindLastIndex(int, Predicate<QueryTable>)
FindLastIndex(int, int, Predicate<QueryTable>)
GetEnumerator()
IndexOf(QueryTable)
IndexOf(QueryTable, int)
IndexOf(QueryTable, int, int)
LastIndexOf(QueryTable)
LastIndexOf(QueryTable, int)
LastIndexOf(QueryTable, int, int)
RemoveAt(int)

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class QueryTableCollectionDemo
    {
        public static void QueryTableCollectionExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            
            // Access the first worksheet in the workbook
            Worksheet worksheet = workbook.Worksheets[0];
            
            // Access the QueryTableCollection of the worksheet
            QueryTableCollection queryTables = worksheet.QueryTables;
            
            // Display the count of QueryTables in the worksheet
            Console.WriteLine("Number of QueryTables: " + queryTables.Count);
            
            // Set the capacity of the QueryTableCollection
            queryTables.Capacity = 10;
            Console.WriteLine("Capacity of QueryTableCollection: " + queryTables.Capacity);
            
            // Assuming there is at least one QueryTable, access the first QueryTable
            if (queryTables.Count > 0)
            {
                QueryTable queryTable = queryTables[0];
                Console.WriteLine("First QueryTable accessed.");
            }
            else
            {
                Console.WriteLine("No QueryTables found in the worksheet.");
            }
            
            // Save the workbook
            workbook.Save("QueryTableCollectionExample.xlsx");
        }
    }
}

See Also