[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Expressions.WorkbookReference

WorkbookReference Class

Represents a reference to an external workbook.

This class identifies an external workbook by file path, URI, or workbook name and is typically used together with Reference when building or modifying formula references. A workbook reference can be created by using FromFilePath(string), FromUri(string), or FromName(string).

Inheritance
WorkbookReference
Namespace: GrapeCity.Documents.Excel.Expressions
Assembly: DS.Documents.Excel.dll
Syntax
public sealed class WorkbookReference : IEquatable<WorkbookReference>
Public NotInheritable Class WorkbookReference
    Implements IEquatable(Of WorkbookReference)
Examples
GrapeCity.Documents.Excel.Expressions.NameNode nameNode = new GrapeCity.Documents.Excel.Expressions.NameNode("January");
nameNode.WorksheetName = "Sheet1";
nameNode.Workbook = WorkbookReference.FromName("Sales.xlsx");

Properties

Name Description
BaseDirectory

Gets the base directory that contains the workbook.

If the returned value is not null, Name represents the file name of the workbook. If the returned value is an empty string, the path is the root directory.

BaseUri

Gets the base URI that contains the workbook.

If the returned value is not null, Name returns the workbook file name.

For example, for the URI https://www.example.com/file/example.xlsx, the base URI is https://www.example.com/file and the workbook name is example.xlsx.

Name

Gets the name of the workbook.

Methods

Name Description
Equals(WorkbookReference)

Check if the workbook reference equals to another.

Equals(object)

Checks whether this workbook reference is equal to another workbook reference.

This method returns true only when other is not null and its base directory, workbook name, base URI, and workbook ID are equal to those of the current instance.

FromFilePath(string)

Creates a workbook reference from a file path.

This method splits the specified path into a base directory and workbook name. If the path points to a workbook in the root directory, the returned reference uses an empty string for BaseDirectory.

FromName(string)

Creates a workbook reference from a workbook name.

Use this method when the workbook should be identified by name rather than by a file path or URI. The specified name can be different from the file name.

FromUri(string)

Creates a workbook reference from an absolute URI to a workbook.

This method creates a reference whose base URI is the URI path up to, but not including, the workbook file name. File URIs are not supported. The specified URI must be absolute, must contain a host, and must contain a workbook file name.

GetHashCode()

Gets hash code of the workbook reference.

ToString()

Gets the string representation of this workbook reference.

The returned string depends on how the reference was created. If this reference has no workbook name, the returned string is the workbook ID enclosed in square brackets. If it uses a base URI, the returned string combines the unescaped base URI with the unescaped workbook name in square brackets. If it stores only a workbook name, the returned string is the name enclosed in square brackets. If it uses a base directory, the returned string combines the base directory and the workbook name in square brackets.