Solved

Path of Workbook

Posted on 2016-10-05
3
92 Views
Last Modified: 2016-10-05
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
Comment
Question by:HuaMinChen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Expert Comment

by:Gustav Brock
ID: 41829566
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
 
LVL 11

Author Comment

by:HuaMinChen
ID: 41829610
Sorry, using this

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

Open in new window


I do not get its full path.
0
 
LVL 51

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 41829616
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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question