I am using DSOFile.OleDocumentPropertiesClass for getting the page count for office documents without automation. This works fine for docx and pptx files but returns always 0 for xlsx files.
DSOFile.OleDocumentPropertiesClass oleDocument = new DSOFile.OleDocumentPropertiesClass();
oleDocument.Open(documentFilePath, true, DSOFile.dsoFileOpenOptions.dsoOptionOpenReadOnlyIfNoWriteAccess);
//WORKS FOR DOCX
int pageCount = oleDocument.SummaryProperties.PageCount;
//WORKS FOR PPTS
int pageCount = oleDocument.SummaryProperties.SheetCount;
//NONE OF ABOVE WORKS FOR XLSX, IT ALWAYS RETURNS 0