An Excel workbook can get “hidden” when you embed it within a PowerPoint.
In Office 2007, its possible to embed an Excel worksheet within a PowerPoint slide. You can do this from within PowerPoint by navigating to the ‘Insert’ tab in the Ribbon and then clicking ‘Object’ in the Text grouping. The dialog box that appears will allow you to create one of several predefined New objects in your slide, or you can Browse to insert an existing object from a file. From here we can select an Excel .xlsx we’ve created, and the worksheet will appear within our slide.
This can be very cool and useful if we have some analysis we’d like to present. Also, whenever we select the inserted worksheet within the slide, it will automatically open in Excel so we can continue to tweak on it using Excel’s functionality.
So embed an Excel document in a PowerPoint (from an existing file). But don’t touch or select or tweak the embedding in the slide, just save the presentation .pptx somewhere. Change the .pptx extension to .zip, unzip the document, and you’ll find the embedded Excel .xlsx under /ppt/embeddings. Yep, there’s a complete Excel .xlsx package within your PowerPoint .pptx. Now open the .xlsx directly in Excel by double-clicking it; the Excel application will launch, but NOTHING IS VISIBLE! EVEN THOUGH THE SPREADSHEET IS THERE! EXCEL WILL APPEAR AS IF NO WORKBOOKS ARE OPENED!!!
You have to navigate to ‘View’ on the Ribbon and click ‘Unhide’ to see the document.
If you unzip the .xlsx and examine workbook.xml, you’ll find:
/workbook/bookViews/workbookView/@visibility = “hidden” .
This attribute is set for the embedded document, even though it wasn’t set in the original prior to embedding.
But guess what, if you would’ve tweaked the embedding by selecting it or resizing it in the slide prior to saving the .pptx, this attribute wouldn’t be set. You can open the .xlsx and the workbook IS VISIBLE. This seems to be an odd quirk of PowerPoint’s default behavior that I stumbled upon while embedding documents programmatically.
I can understand why a behavior like this might go unnoticed if it’s expected the embedded document will only ever be opened within PowerPoint again. In PowerPoint the embedded .xlsx opens and is always visible within the context of the slides.
The thing is, I’m saving these documents to MarkLogic Server, where I automatically unzip all Office 2007 documents so I can search and reuse the XML, document parts, and original source .pptx, .xlsx, .docx, etc. in the creation of new Office and other documents. In MarkLogic, one of the things I’m doing for an app is making embedded Office docs available as independent documents within search results. It’s freedom baby, yeah! And while we’re seeing this behavior with embedding, we now know that its possible to hide any workbook using that simple attribute.
So if we want our users to be able to view the Excel documents they are selecting for use, a simple solution is to just remove the @visible and rezip the .xlsx in MarkLogic, either in the saved .xlsx, or when opening the embedded doc from the rezipping of its extracted parts, or both. Remove that attribute and we’re all good for visibility.
Or, if you’re feeling particularly ornery, I guess you could add the attribute to all your organization’s Excel workbooks and watch your users go mad? Maybe there’s a use-case for that, I don’t know.
But I thought this was interesting so I’d share. Maybe this will help someone who’s tweaking on this random behavior or with AddOLEObject as well. You can have a .xlsx on your filesystem. You can unzip and see the workbook and worksheet parts. You can double-click the .xlsx and it will open in Excel, but nothing is visible, even though the worksheet information *IS* saved in the .xlsx package and available in the Excel application. It turns out the document is actually open, but hidden. You just have to ‘Unhide’ it.