5
我試圖使用EPPlus在我們的LAN上保存電子表格。我使用的是FileStream
對象要做到這一點,但是每當我試圖實例,我得到了錯誤的對象FileStream - 「不支持給定路徑的格式」
The given path's format is not supported
C#
private static string _fileName = "ErroredRows_";
private static string _results =
@"\\prdhilfs03\l&i-sales&mkt\WORKAREA\Agencyservices\Shared\AIC\Analysts_and_Reporting\Realignments\2014\MassUpdateTesting\Results\";
public static void WriteSpreadsheet(Dictionary<DataRow, string> errors)
{
//Create download Destination
string filePath = System.IO.Path.Combine(_results, _fileName + DateTime.Now.ToString("yyyy-MM-dd_HH:mm:ss") + ".xlsx");
FileStream newFile = new FileStream(filePath, FileMode.Create, FileAccess.Write);
//Construct new Excel package
ExcelPackage pck = new ExcelPackage(newFile);
//Instantiate workbook object
var ws = pck.Workbook.Worksheets.Add("Query1");
這裏的filePath
string
變量的內容。
\\\\prdhilfs03\\l&i-sales&mkt\\WORKAREA\\Agencyservices\\Shared\\AIC\\Analysts_and_Reporting\\Realignments\\2014\\MassUpdateTesting\\Results\\ErroredRows_2014-01-30_13:46:33.xlsx
此行拋出上述錯誤:
FileStream newFile = new FileStream(filePath, FileMode.Create, FileAccess.Write);
你不能在文件名或路徑中使用':' –
尼斯:)如果你想把它作爲答案接受它。謝謝 – NealR