Class ReferredAreaCollection
Contents
[
Hide
]ReferredAreaCollection class
Represents all referred cells and areas.
public class ReferredAreaCollection : CollectionBase<ReferredArea>
Properties
Name | Description |
---|---|
Capacity { get; set; } | |
Count { get; } | |
Item { get; } | |
Item { get; set; } |
Methods
Name | Description |
---|---|
BinarySearch(ReferredArea) | |
BinarySearch(ReferredArea, IComparer<ReferredArea>) | |
BinarySearch(int, int, ReferredArea, IComparer<ReferredArea>) | |
Clear() | |
Contains(ReferredArea) | |
CopyTo(ReferredArea[]) | |
CopyTo(ReferredArea[], int) | |
CopyTo(int, ReferredArea[], int, int) | |
Exists(Predicate<ReferredArea>) | |
Find(Predicate<ReferredArea>) | |
FindAll(Predicate<ReferredArea>) | |
FindIndex(Predicate<ReferredArea>) | |
FindIndex(int, Predicate<ReferredArea>) | |
FindIndex(int, int, Predicate<ReferredArea>) | |
FindLast(Predicate<ReferredArea>) | |
FindLastIndex(Predicate<ReferredArea>) | |
FindLastIndex(int, Predicate<ReferredArea>) | |
FindLastIndex(int, int, Predicate<ReferredArea>) | |
GetEnumerator() | |
IndexOf(ReferredArea) | |
IndexOf(ReferredArea, int) | |
IndexOf(ReferredArea, int, int) | |
LastIndexOf(ReferredArea) | |
LastIndexOf(ReferredArea, int) | |
LastIndexOf(ReferredArea, int, int) | |
RemoveAt(int) |
Examples
using System;
using System.Text;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class CellsClassReferredAreaCollectionDemo
{
public static void Run()
{
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Set values in cells A2:C3 that will be referenced by E1
worksheet.Cells["A2"].PutValue(1);
worksheet.Cells["B2"].PutValue(2);
worksheet.Cells["C2"].PutValue(3);
worksheet.Cells["A3"].PutValue(4);
worksheet.Cells["B3"].PutValue(5);
worksheet.Cells["C3"].PutValue(6);
// Create formula in E1 that references A2:C3
worksheet.Cells["E1"].Formula = "=SUM(A2:C3)";
// Get precedents of E1
ReferredAreaCollection referredAreas = worksheet.Cells["E1"].GetPrecedents();
if (referredAreas != null)
{
foreach (ReferredArea area in referredAreas)
{
StringBuilder sb = new StringBuilder();
if (area.IsExternalLink)
{
sb.Append("[");
sb.Append(area.ExternalFileName);
sb.Append("]");
}
sb.Append(area.SheetName);
sb.Append("!");
sb.Append(CellsHelper.CellIndexToName(area.StartRow, area.StartColumn));
if (area.IsArea)
{
sb.Append(":");
sb.Append(CellsHelper.CellIndexToName(area.EndRow, area.EndColumn));
}
Console.WriteLine("Referred area: " + sb.ToString());
}
}
}
}
}
See Also
- class CollectionBase<T>
- class ReferredArea
- namespace Aspose.Cells
- assembly Aspose.Cells