none
How to detect if an openXML Excel file (.xlsx) represents a Shared Workbook via openXML SDK or examination of XML files... RRS feed

  • Question

  • I need a programmatic solution independent of Office App that can detect if an xlsx file represents a Shared Workbook.  I can do this easily for the case of Structured Storage documents (.xls) based on presence or absence of stream "User Names".  For openXML I thought this was covered by the <SharedDoc> element in docProps\app.xml but this seems to always be false, regardless of whether or not the document is shared.  The openXML SDK seems to behave similarly:

     

               SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(filepath, true);
                WorkbookPart wbp = spreadsheetDocument.WorkbookPart;
                Workbook wb = wbp.Workbook;
                FileSharing fs = wb.FileSharing;  

    In this case fs is always null.

    I could not find anything else in ECMA-376 docs that looked related.

    I guess the information must be hidden away somewhere in there since Excel can make the correct determination.

    Anyone know how to do this?

    Thanks

    Thursday, May 7, 2015 6:11 PM

Answers

  • See the screen shot kindly provided by Satarain Chen here:

    < https://social.msdn.microsoft.com/Forums/en-US/58edb7a2-e341-4300-9a2e-a0ec2bd40dcc/detect-if-excel-workbook-openxml-or-structured-storage-is-a-shared-workbook-outside-of-office?forum=appsforoffice >

    This is using the openXML SDK-based tool that supports browsing and comparison of files.

    Friday, May 8, 2015 1:40 PM
  • Hi Peter, for additional details about the various revision files, and for the benefit of the anyone who isn't using the OpenXML SDK, please see the following sections in ISO/IEC 29500, Part 1.

     

    • 12.3.16 - Shared Workbook Revision Headers Part
    • 12.3.17 - Shared Workbook Revision Log Part
    • 12.3.18 - Shared Workbook User Data Part

    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Monday, May 11, 2015 5:14 PM
    Moderator

All replies

  • Never mind - looks like there are extra .xml files in the set for the shared case

    • /xl/revisions/_rels/revisionHeaders.xml.rels
    • /xl/revisions/revisionHeaders.xml
    • /xl/revisions/revisionLog1.xml
    • /xl/revisions/userNames.xml
    Thursday, May 7, 2015 6:31 PM
  • Peter,

    Thank you for your post.  Where did you find your answer?


    Bryan S. Burgin Senior Escalation Engineer Microsoft Protocol Open Specifications Team

    Thursday, May 7, 2015 8:53 PM
    Moderator
  • See the screen shot kindly provided by Satarain Chen here:

    < https://social.msdn.microsoft.com/Forums/en-US/58edb7a2-e341-4300-9a2e-a0ec2bd40dcc/detect-if-excel-workbook-openxml-or-structured-storage-is-a-shared-workbook-outside-of-office?forum=appsforoffice >

    This is using the openXML SDK-based tool that supports browsing and comparison of files.

    Friday, May 8, 2015 1:40 PM
  • Hi Peter, for additional details about the various revision files, and for the benefit of the anyone who isn't using the OpenXML SDK, please see the following sections in ISO/IEC 29500, Part 1.

     

    • 12.3.16 - Shared Workbook Revision Headers Part
    • 12.3.17 - Shared Workbook Revision Log Part
    • 12.3.18 - Shared Workbook User Data Part

    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Monday, May 11, 2015 5:14 PM
    Moderator