Class CellWatchCollection
CellWatchCollection class
Represents the collection of cells on this worksheet being watched in the ‘watch window’.
public class CellWatchCollection : CollectionBase<CellWatch>
Constructors
Properties
Methods
| Name | Description |
|---|
| Add(string) | Adds CellWatch with the name the of cell. |
| Add(int, int) | Adds CellWatch with row and column. |
| BinarySearch(CellWatch) | |
| BinarySearch(CellWatch, IComparer<CellWatch>) | |
| BinarySearch(int, int, CellWatch, IComparer<CellWatch>) | |
| Clear() | |
| Contains(CellWatch) | |
| CopyTo(CellWatch[]) | |
| CopyTo(CellWatch[], int) | |
| CopyTo(int, CellWatch[], int, int) | |
| Exists(Predicate<CellWatch>) | |
| Find(Predicate<CellWatch>) | |
| FindAll(Predicate<CellWatch>) | |
| FindIndex(Predicate<CellWatch>) | |
| FindIndex(int, Predicate<CellWatch>) | |
| FindIndex(int, int, Predicate<CellWatch>) | |
| FindLast(Predicate<CellWatch>) | |
| FindLastIndex(Predicate<CellWatch>) | |
| FindLastIndex(int, Predicate<CellWatch>) | |
| FindLastIndex(int, int, Predicate<CellWatch>) | |
| GetEnumerator() | |
| IndexOf(CellWatch) | |
| IndexOf(CellWatch, int) | |
| IndexOf(CellWatch, int, int) | |
| LastIndexOf(CellWatch) | |
| LastIndexOf(CellWatch, int) | |
| LastIndexOf(CellWatch, int, int) | |
| RemoveAt(int) | |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class CellWatchCollectionDemo
{
public static void CellWatchCollectionExample()
{
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Get the first Worksheet
Worksheet sheet = workbook.Worksheets[0];
// Add Cell Watch Item into the watch window
int watchIndex = sheet.CellWatches.Add("B2");
// Access the CellWatchCollection
CellWatchCollection cellWatches = sheet.CellWatches;
// Access the added CellWatch item
CellWatch cellWatch = cellWatches[watchIndex];
// Display the properties of the CellWatch item
Console.WriteLine("Cell Watch Details:");
Console.WriteLine($"Row: {cellWatch.Row}");
Console.WriteLine($"Column: {cellWatch.Column}");
Console.WriteLine($"Cell Name: {cellWatch.CellName}");
// Modify the properties of the CellWatch item
cellWatch.Row = 1;
cellWatch.Column = 1;
cellWatch.CellName = "A2";
// Display the modified properties of the CellWatch item
Console.WriteLine("Modified Cell Watch Details:");
Console.WriteLine($"Row: {cellWatch.Row}");
Console.WriteLine($"Column: {cellWatch.Column}");
Console.WriteLine($"Cell Name: {cellWatch.CellName}");
// Save the workbook
workbook.Save("CellWatchCollectionExample.xlsx");
workbook.Save("CellWatchCollectionExample.pdf");
}
}
}
See Also