• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 103
  • Last Modified:

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?
0
HuaMinChen
Asked:
HuaMinChen
  • 2
1 Solution
 
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
 
HuaMinChenBusiness AnalystAuthor Commented:
Sorry, using this

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

Open in new window


I do not get its full path.
0
 
Gustav BrockCIOCommented:
Sorry, missed that:

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

/gustav
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now