Path of Workbook

Hi,
I want to know relevant path of the Workbook, per given codes below
                using (FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
                {
                    
                    using (SpreadsheetDocument doc = SpreadsheetDocument.Open(fs, false))
                    {
                        WorkbookPart workbookPart = doc.WorkbookPart;
                        ...

Open in new window

How?
LVL 11
HuaMin ChenSystem AnalystAsked:
Who is Participating?
 
Gustav BrockCIOCommented:
Sorry, missed that:

    string fullPath = openFileDialog1.FileName;
    string folderOnly = Path.GetDirectoryName(openFileDialog1.FileName);

/gustav
0
 
Gustav BrockCIOCommented:
The workbook file would be

    workbookFile = Path.GetFileName(openFileDialog1.FileName);

so you will have to use lesser obtuse code for your first code line.

/gustav
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Sorry, using this

string Path0 = Path.GetFileName(openFileDialog1.FileName);

Open in new window


I do not get its full path.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.