I'm using ClosedXML to create a really complex file referencing many external files with formulas.
The file is generated on a server, so I can't use an absolute path, but the relative path is not working properly.
Every time I try to create a relative path, Excel searches only under user documents folder, but not in the same path of the main file, where all references are.
Is there any way to specify a relative path that works properly?
Here is my code:
//In example '[filename.xlsx]sheet'!E2
string cellRef = "'[" + filename+ "]" + sheetname+ "'!E" + indexRow;
worksheet.Cell(i, index + 4).FormulaA1 = cellRef;