Class ExternalLinkCollection
Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)
Represents external links collection in a workbook.
public class ExternalLinkCollection : IEnumerable
Inheritance
object ← ExternalLinkCollection
Implements
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Examples
//Open a file with external links
Workbook workbook = new Workbook("book1.xls");
//Change external link data source
workbook.Worksheets.ExternalLinks[0].DataSource = "d:\\link.xls";
'Open a file with external links
Dim workbook As Workbook = New Workbook("book1.xls")
'Change external link data source
workbook.Worksheets.ExternalLinks(0).DataSource = "d:\\link.xls"
Properties
Count
Gets the number of elements actually contained in the collection.
public int Count { get; }
Property Value
this[int]
Gets the Aspose.Cells.ExternalLink element at the specified index.
public ExternalLink this[int index] { get; }
Property Value
Methods
Add(string, string[])
Adds an external link.
public int Add(string fileName, string[] sheetNames)
Parameters
fileName
string
The external file name.
sheetNames
string[]
All sheet names of the external file.
Returns
The position of the external name in this list.
Add(DirectoryType, string, string[])
Add an external link .
public int Add(DirectoryType directoryType, string fileName, string[] sheetNames)
Parameters
directoryType
DirectoryType
The directory type of the file name.
fileName
string
the file name.
sheetNames
string[]
All sheet names of the external file.
Returns
The position of the external name in this list.
Clear()
Removes all external links.
public void Clear()
Remarks
When removing external links, all formulas that reference to them will be removed too because the references become invalid.
Clear(bool)
Removes all external links.
public void Clear(bool updateReferencesAsLocal)
Parameters
updateReferencesAsLocal
bool
Whether update all references of external links in formulas to references of current workbook itself.
Remarks
If references are required to be updated, those references of external links in formulas
will be changed to current workbook when it is possible.
For example, one cell’s original formula is “=‘externalsource.xlam’!customfunction()”,
after removing external links, the formula will become “=customfunction()”;
When the original formula is “=’[externalsource.xlam]Sheet1’!$A$1”,
according to whether there is one sheet with name “Sheet1” in current workbook:
if true, the formula will become “=Sheet1!$A$1”;
if false, the formula will become “=#REF!$A$1”.
If references are not required to be updated, all formulas with references to external links
will be removed too because those references become invalid.
GetEnumerator()
Get an enumerator that iterates through this collection.
public IEnumerator GetEnumerator()
Returns
RemoveAt(int)
Removes the specified external link from the workbook.
public void RemoveAt(int index)
Parameters
index
int
the index of the external link to be removed.
Remarks
When removing the external link, all formulas that reference to it will be removed too because the references become invalid.
RemoveAt(int, bool)
Removes the specified external link from the workbook.
public void RemoveAt(int index, bool updateReferencesAsLocal)
Parameters
index
int
the index of the external link to be removed.
updateReferencesAsLocal
bool
Whether update all references of given external link to reference of current workbook itself. Check Aspose.Cells.ExternalLinkCollection.Clear(System.Boolean) to get more details about this parameter.