Extracting thumbnail/preview from Office Documents

Add-in Express™ Support Service
That's what is more important than anything else

Extracting thumbnail/preview from Office Documents
 
Mike McGavin




Posts: 38
Joined: 2011-05-31
Hello.

Word, Excel and other Office apps let a user save a thumbnail image for a document or template, by ticking the Save Thumbnail check-box in the Save As dialog. The thumbnails can show up in places like the My Templates dialog (in its Preview area), Windows icons, and so on.

I'm trying to figure out how to extract these thumbnails for my own use, so I can help a user choose a template through my own GUI. Is there some kind of Word or ADX api thing available, or am I looking in the wrong place?

Thanks for any help.
Mike.
Posted 16 Jan, 2013 23:57:24 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
Hello Mike,

This isn't available through the Office object models. The key words are "structured storage", see http://www.i-programmer.info/projects/38-windows/570-com-structured-storage-in-net.html.


Andrei Smolin
Add-in Express Team Leader
Posted 17 Jan, 2013 02:22:07 Top
Mike McGavin




Posts: 38
Joined: 2011-05-31
Thanks, Andrei. That'll be helpful. To help answer my question in case anyone else needs something similar to this, I've also stumbled overnight on the http://archive.msdn.microsoft.com/WindowsAPICodePack, which (after referencing one of the included assemblies) lets me leverage the Windows API to do something very simple, similar to the following:


Microsoft.WindowsAPICodePack.Shell.ShellFile shellFile = Microsoft.WindowsAPICodePack.Shell.ShellFile.FromFilePath(tti.FullFilename);
Image i = shellFile.Thumbnail.MediumBitmap;


Windows 7, at least, seems smart enough to extract thumbnails from Office documents (and displays them as part of an Office document icon), so it might be enough for what I want.

Thanks very much for the help.
Mike.
Posted 17 Jan, 2013 15:52:04 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
Thank you very much for posting these details!


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jan, 2013 02:09:51 Top