Create Preview of Office Dokuments

BenniG
02-22-2005, 04:38 PM
Hi,

I've little expierience in Office Automation on VB6, (extracting plain-text from excel,word,powerpoint) and I want to switch the Code to VB.NET and also add a new Feature: A Picture of the Preview of the Document.
I just want to save the little preview-picture of the document just like the picture the windows-explorer shows on the left side when you select an office-dokument.
Has anybody ever done this? Does this belong to office-automation or it this a special feature of the windows-explorer?

Many thanks
Benni

Mike Rosenblum
02-22-2005, 05:01 PM
For Automating MS Office Applications from VB.Net, you could have a start at:

(1) VB.Net Office Automation FAQ (http://www.visualbasicforum.com/showthread.php?t=160459)
(2) Automating Office Programs with VB.Net / COM Interop (http://www.xtremevbtalk.com/showthread.php?t=160433)

The PrintPreview setting, however, is a document-specific feature that I'm not sure how to access programmatically. My best guess would be to use DSOFile.exe (http://support.microsoft.com/default.aspx/kb/q224351/), however, this doesn't look like a lot of fun. :(

If I were to do this, I would make a Template Workbook that had this setting turned on via Alt|File|Properties... then hit the 'Summary' Tab and then check off the 'Save Preview Picture' checkbox. Then save this Workbook, say calling it "PrevPicTemplate.xls" and that setting will "stick".

Now when you need to make a new Workbook and manipulate it programmatically, I would start with that Template workbook using:Dim wb As Excel.Workbook
wb = xlApp.Workbooks.Add(Template:="PrevPicTemplate.xls")
' etc.
' etc. Whatever you add from this point, the 'Preview Picture' will be saved along with this workbook when you call wb.Save() or wb.SaveAs().

I hope this makes sense?
Mike

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum