I am going crazy here. I cannot identify absolute paths in workbooks. The following code returns null on spreadsheets, which I can look in the xml (/xl/workbook.xml) has absolute path.
Can anybody please test the code and confirm if this is a bug ion Open XML SDK or my code?
XML qualified name is "x15ac:absPath".
Link to Open XML SDK info: https://docs.microsoft.com/en-us/dotnet/api/documentformat.openxml.office2013.excelac.absolutepath?view=openxml-2.8.1
Code
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Office2013.ExcelAc;
public bool Check_AbsolutePath(string filepath)
{
bool absolutepath = false;
using (SpreadsheetDocument spreadsheet = SpreadsheetDocument.Open(filepath, false))
{
if (spreadsheet.WorkbookPart.Workbook.AbsolutePath != null)
{
Console.WriteLine("--> Absolute path to local directory detected");
absolutepath = true;
}
}
return absolutepath;
}
UPDATE
I have created this as issue on Open XML SDK repo: https://github.com/OfficeDev/Open-XML-SDK/issues/1208