Inside the directory of the .exe, there is a folder called exports
. I have a method that takes parameters for a directory and filename.
In this case, I want to give the directory as this exports
folder. The following is the current code:
public void saveFile(string dir, string filename)
{
ExcelPackage pck = new ExcelPackage();
// creating a spreadsheet...
// now save the file
System.IO.FileInfo file = new System.IO.FileInfo(System.IO.Path.Combine(dir, filename) + ".xlsx");
pck.Save(file);
pck.Dispose();
}
// usage of the above method
saveFile(System.Reflection.Assembly.GetExecutingAssembly().Location + @"\exports", "myFileName");
This yields an exception: "The given path's format is not supported". How to solve this?