[]
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).
com.grapecity.documents.excel.expressions.NameNode nameNode = new com.grapecity.documents.excel.expressions.NameNode("January");
nameNode.setWorksheetName("Sheet1");
nameNode.setWorkbook(WorkbookReference.FromName("Sales.xlsx"));
booleanequals(WorkbookReference other) booleanstatic WorkbookReferenceFromFilePath(String workbookFullPath) static WorkbookReferencestatic WorkbookReferenceintgetId()getName()inthashCode()toString()If the returned value is not null, getName() represents the file name of the workbook. If the returned value is an empty string, the path is the root directory.
String workbookFullPath = java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "Budget.xlsx").toString();
WorkbookReference reference = WorkbookReference.FromFilePath(workbookFullPath);
String baseDirectory = reference.getBaseDirectory();
null if no base directory is available.If the returned value is not null, getName() 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.
WorkbookReference reference = WorkbookReference.FromUri("https://somesite.com/files/sample.xlsx");
String baseUri = reference.getBaseUri();
null if this workbook reference does not use a URI-based location.If getBaseDirectory() is not null, the returned value represents the file name of the workbook. If this reference was created by FromName(String), the returned value is the workbook name that was provided when the reference was created.
String workbookFullPath = java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "Budget.xlsx").toString();
WorkbookReference reference = WorkbookReference.FromFilePath(workbookFullPath);
String name = reference.getName();
The default value is 0, which indicates the current workbook.
String workbookFullPath = java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "Budget.xlsx").toString();
WorkbookReference reference = WorkbookReference.FromFilePath(workbookFullPath);
int id = reference.getId();
0 for the current workbook.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 getBaseDirectory().
String workbookFullPath = java.nio.file.Paths.get("Users", "DefaultApps", "Documents", "Budget.xlsx").toString();
WorkbookReference reference = WorkbookReference.FromFilePath(workbookFullPath);
String baseDirectory = reference.getBaseDirectory();
String name = reference.getName();
workbookFullPath - The full path of the workbook. Must not be null or empty, and must contain both a directory part and a file name.WorkbookReference created from the specified file path.NullPointerException - if workbookFullPath is null or empty.IllegalArgumentException - if the specified path does not contain a directory part or does not contain a file name.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.
WorkbookReference reference = WorkbookReference.FromUri("https://somesite.com/files/sample.xlsx");
String baseUri = reference.getBaseUri();
String name = reference.getName();
uri - The absolute URI of the workbook. Must not be null, must not be a file URI, and must include both a host and a file name.WorkbookReference created from the specified URI.IllegalArgumentException - if uri is not a valid absolute URI, if it is a file URI, or if it does not contain a host or workbook file 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.
WorkbookReference reference = WorkbookReference.FromName("Budget");
String name = reference.getName();
name - The workbook name. Must not be null or empty.WorkbookReference that stores the specified workbook name.NullPointerException - if name is null or empty.This method returns true only when obj is a WorkbookReference and its base directory, workbook name, base URI, and workbook ID are equal to those of the current instance. If obj is not a WorkbookReference, this method forwards null to equals(WorkbookReference) and returns false.
equals in class Objectobj - The object to compare with this workbook reference. If obj is not a WorkbookReference, this method returns false.true if obj is a WorkbookReference with the same base directory, workbook name, base URI, and workbook ID; otherwise, false.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.
other - The workbook reference to compare with this workbook reference. If other is null, this method returns false.true if other has the same base directory, workbook name, base URI, and workbook ID as this workbook reference; otherwise, false.The returned hash code is computed from the base directory, base URI, workbook name, and workbook ID of this instance. References that are equal according to equals(Object) return the same hash code.
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.