OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Thread Tools Search this Thread Display Modes
Old 10-05-2003, 14:16
Posts: n/a
Default Preview from CorelDRAW file and/or worksheet


I’m trying to accomplish two things, any hint or example code would be very helpful because I do not even know where to begin.

I’m trying to extrude a preview form a CorelDRAW file (version 8, 9 10 and 11) using Visual Basic 6, VBA for CorelDRAW or CorelSCRIPT.

I’m trying to generate a preview from the active worksheet to use in a worksheet manipulation Wizard. For this I’m also using Visual Basic 6, VBA for CorelDRAW or CorelSCRIPT.

If there are no available samples or hints for Visual Basic 6, VBA for CorelDRAW or CorelSCRIPT then any C, C++ or MFC sample would also help. C, C++ or MFC are not my "native languages" but at I can read the code a little.
Reply With Quote
Old 14-05-2003, 09:12
Posts: n/a

what exactly do you mean by "preview"? are you wanting to export the file into some other format to use elsewhere? i'm not quite following exactly what you're needing... :?
Reply With Quote
Old 14-05-2003, 13:51
Posts: n/a

Thanks for asking,

Part 1
CorelDRAW has a preview bitmap enclosed in their binary file format. This preview is always on the same location (as far as I know) in the CDR file. I want to create a Wizard that can handle pre-made templates in CDR format (for repetitive designing tasks). In that Wizard someone has to pick the template of his/here choice. I could add a custom made preview in a sort of database but then you would have no preview in the Wizard when you make your own template.
If I had a way to extract that bitmap data (the preview) from the CDR file I wouldn’t have to make a custom preview for every template.

Part 2
Once a template is open (you see the worksheet behind the Wizard) there will be some items that the Wizard can replace like text or another part of the design like a piece of clipart. Then it would be nice if there was a way you could generate a preview from the active worksheet and point out in the Wizard that a circled part of the preview is the part of the worksheet you are going to replace. If there where several items of text to replace the Wizard will probably be always right in front of the active worksheet hiding the design and then it will be very difficult to tell which text you are chancing at that moment (where in the design it actually is located).

Part 2 could probably be achieved by a solution of part 1. I could search the newly opened template where exact the locations of the parts that can be replaced are in the worksheet, use the preview from part 1 and circle the locations in the preview. But this is complicated and maybe there is an easier way to do this.

I hope this clarifies things a little and that you can help me.
Reply With Quote
Old 14-05-2003, 17:03
Posts: n/a

hmmm, i have no idea how to do that. maybe alex does...

Reply With Quote
Old 15-05-2003, 12:53
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,941
Blog Entries: 4
Default Extracting thumbnails

You can extract thumbnails from a CDR file by using GetCDRFileThumbnail function of CorelScript object. You need to have CorelDRAW running for this though.

Here is how you do it:

CorelScript.GetCDRFileThumbnail "C:\Graphic1.cdr", "C:\Thumbnail.bmp"
This will save the image as a BMP file with the specified file name.

As for the second part of your problem, I'm not sure you can do it. There is very little chance you can find any object location information in a CDR file. It is way buried into and the format constantly changes from version to version.
Reply With Quote
Old 15-05-2003, 18:29
Posts: n/a

Thanks Alex, this works!

On the second part I was probably not clear enough.
I will not look for locations in the file it self but in the worksheet when it is open. I get the extends of all the objects on the worksheet and draw a square round the extends with the center of the extends as the center of the square (to get the same positioning as in the square thumbnail), then iterate trough the objects and find the objects that can be replaced and their extends. The extends and location of the replaceable objects on the worksheet I then scale down to locations in the thumbnail.

Sorry for my English but I’m Dutch and tend to write English sentences in Dutch grammar.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CorelDraw 10 DXF export relative coordinates - VBA solution? asb617 CorelDRAW/Corel DESIGNER VBA 2 01-04-2010 02:34
CorelDraw 8 error in DLL file - help !!! cannot open!!! Anonymous General 4 31-10-2004 15:52
run macro at start up Corel 11 ???? -=HKLC=- CorelDRAW/Corel DESIGNER VBA 14 30-10-2004 09:29
Open - Resize - Savefile in Photo Paint greenee Corel Photo-Paint VBA 2 28-06-2003 03:54

All times are GMT -5. The time now is 00:32.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com