Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB6 / CR9 - Show Crystal Report thumbnail / preview 1

Status
Not open for further replies.

Sindo

IS-IT--Management
May 8, 2002
11
GB
Does anyone know how to show the 'Preview Picture' for a crystal report in a VB6 app ?

I have a selection screen that allows the user to pick a report and I want to add this feature so they can find their reports quicker.

Cheers

Sindo
 
Hi vidru,

Hmm looks like you might be right :(

Thanks

Sindo

 
There is a way. I had completely forgotten about this, after using it to get to the Revision number of a file:

A demo program is included to get you started. I suggest stepping through the code, as I was consistently getting errors with the 5 or so lines under:

[green]' Add a few other items that pertain to OLE files only...[/green]

I ended up just commenting it out. Anyway, when you run it, open an rpt file that has a preview picture saved, then when the file information is loaded, check the 'Preview Document' checkbox to see your preview image.

-dave
 
Just in case this will be useful for anyone else here's my final code. I've got a picture box on the form called RepPreview and you'll need to reference the dsofile.dll file which can be found at the link vidru provided above.


'This goes in the general declarations
Private RPTProps As DSOFile.OleDocumentProperties

Function OpenDocumentProperties(sFile As String)
Dim RPTSummProps As DSOFile.SummaryProperties, RPTPicDisp As StdPicture

Set RPTProps = New DSOFile.OleDocumentProperties
RPTProps.Open sFile
Set RPTSummProps = RPTProps.SummaryProperties
If Not IsEmpty(RPTSummProps.Thumbnail) Then
Set RPTPicDisp = RPTSummProps.Thumbnail
If Not RPTPicDisp Is Nothing Then
Set RepPreview.Picture = RPTPicDisp
RepPreview.Visible = True
End If
Else
RepPreview.Visible = False
Set RepPreview.Picture = Nothing
End If
RPTProps.Close
Set RPTProps = Nothing
End Function


Sindo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top