Solved

Path of Workbook

Posted on 2016-10-05
3
73 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
  • 2
3 Comments
 
LVL 49

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 10

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 49

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vlookup for in-between dates 4 37
C# Desktop Application 3 29
Msbbox Notice (4 days) 27 56
Clear Filter 8 29
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

815 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

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now