[]
        
(Showing Draft Content)

GrapeCity.Documents.Excel.Expressions.WorkbookReference.FromFilePath

FromFilePath Method

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.

Declaration
public static WorkbookReference FromFilePath(string workbookFullPath)
Public Shared Function FromFilePath(workbookFullPath As String) As WorkbookReference
Parameters
Type Name Description
string workbookFullPath

The full path of the workbook. Must not be null or empty, and must contain both a directory part and a file name.

Returns
Type Description
WorkbookReference

A WorkbookReference created from the specified file path.

Examples
string workbookFullPath = Path.Combine("Users", "DefaultApps", "Documents", "Budget.xlsx");
WorkbookReference reference = WorkbookReference.FromFilePath(workbookFullPath);
string baseDirectory = reference.BaseDirectory;
string name = reference.Name;
Exceptions
Type Condition
ArgumentNullException

if workbookFullPath is null or empty.

ArgumentException

if the specified path does not contain a directory part or does not contain a file name.