c# - Excel file path doesn't work -
i have (and works):
if (sport == "athletics") { excel_init("c:/users/dries canfyn/desktop/score/scoretablemenathletics.xlsx"); }
but want include excel file in project.
the excel file in folder called io, in same folder class 'if' in. how can reach excel file? path should use?
determine workingdirectory
, use relative path there.
workingdirectory
.exe resides, depends on how started process. can use relative path like
if (sport == "athletics") { excel_init("io/scoretablemenathletics.xlsx"); }
i don't know happens inside excel_init
, consider msdn, processstartinfo.workingdirectory property
:
when useshellexecute property false, gets or sets working directory process started. when useshellexecute true, gets or sets directory contains process started.
Comments
Post a Comment