OberonPlace.com Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 21-01-2003, 07:30
Didier
Guest
 
Posts: n/a
Default Thumbnailer (VBA for Draw9)


Hi
I use CorelDraw 9 (dont have 10 and 11 is too expensive)
I found on the site a CSC script Thumbnailer (it does a fine job !)
I need an equivalent in VBA to mix data with program

Anyone could help
Thanks
Didier
Reply With Quote
  #2  
Old 21-01-2003, 14:32
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Thumbnailer (VBA for Draw9)

Didier,

I'm not sure what you mean by mixing program and data. Can you explain?
Reply With Quote
  #3  
Old 21-01-2003, 15:42
Didier
Guest
 
Posts: n/a
Default Thumbnailer (VBA for Draw9)

Thanks For responding and for not being clear

I want to use an interpreted language (VBA or another one), So I need to use OLE Automation. What I wanted to say in few words is that that will be my coding that will select (with criterias) which object (picture) to import in CorelDraw. Datas will come from SQL and from user interface.
What is difficult at this moment for me is to do the same as Thumbnailer script in VBA (Automation)


Regards
Didier
Reply With Quote
  #4  
Old 22-01-2003, 01:24
Didier
Guest
 
Posts: n/a
Default Re: Thumbnailer (VBA for Draw9)

Quote:
Originally Posted by Didier
Thanks For responding and for not being clear

I want to use an interpreted language (VBA or another one), So I need to use OLE Automation. What I wanted to say in few words is that that will be my coding that will select (with criterias) which object (picture) to import in CorelDraw. Datas will come from SQL and from user interface.
What is difficult at this moment for me is to do the same as Thumbnailer script in VBA (Automation)


Regards
Didier

The correct meaning of the first phrase is
Thanks For responding and SORRY for not being clear

Didier
Reply With Quote
  #5  
Old 04-02-2003, 22:21
Alex's Avatar
Alex Alex is offline
Administrator
 
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4
Default Re: Thumbnailer (VBA for Draw9)

Quote:
Originally Posted by Didier
Thanks For responding and for not being clear

I want to use an interpreted language (VBA or another one), So I need to use OLE Automation. What I wanted to say in few words is that that will be my coding that will select (with criterias) which object (picture) to import in CorelDraw. Datas will come from SQL and from user interface.
What is difficult at this moment for me is to do the same as Thumbnailer script in VBA (Automation)
I assume you know how to select the data you need to import and then eventually you will have the names of the files to import.

Here is a function for you that imports files one by one and places them on a page.

Code:
Sub ImportAndPlace(FileName As String, idx As Long)
    Const NumX As Long = 4 ' Number of thumbnails horizontally
    Const NumY As Long = 6 ' Number of thumbnails vertically
    Const Spacing As Double = 0.1 ' spacing between thumbnails in inches
    
    Dim Width As Double, Height As Double
    Dim x As Double, y As Double
    Dim sx As Double, sy As Double
    Dim nx As Long, ny As Long
    
    ' Calculate the thumb. position on page
    nx = idx Mod NumX
    ny = (idx \ NumX) Mod NumY
    
    If nx = 0 And ny = 0 And idx <> 0 Then
        ' A new page must be inserted
        ActiveDocument.AddPages 1
    End If
    
    ' Get the page size
    ActivePage.GetSize Width, Height
    ' Calculate a thumbnail size
    sx = (Width - (NumX - 1) * Spacing) / NumX
    sy = (Height - (NumY - 1) * Spacing) / NumY
    
    x = (sx + Spacing) * nx
    y = Height - (sy + Spacing) * ny - sy
    
    ' Import the image and reposition it
    ActiveLayer.Import FileName
    If ActiveSelection.Shapes.Count <> 0 Then
        ActiveSelection.SetBoundingBox x, y, sx, sy, True, cdrCenter
    End If
    ' Create a rectangle around the image
    ActiveLayer.CreateRectangle2 x, y, sx, sy
End Sub
Here is a test function that imports all JPEGs from C:\Temp and places them on a page similarly to the good old Thumbnailer script:

Code:
Sub TestImport()
    Dim f As String
    Dim idx As Long
    
    idx = 0
    f = Dir("C:\Temp\*.jpg")
    While f <> ""
        ImportAndPlace "C:\Temp\" & f, idx
        idx = idx + 1
        f = Dir()
    Wend
End Sub
I hope this helps...
Reply With Quote
Reply


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
delete vba project from cdr file hotairballoon CorelDRAW/Corel DESIGNER VBA 1 18-05-2005 09:08
CD 10, VBA not returning true outline width Webster CorelDRAW/Corel DESIGNER VBA 1 24-11-2004 17:09
IT is not safe to use VBA! lees CorelDRAW/Corel DESIGNER VBA 7 10-05-2004 09:54
VBA does not work with my CD 10 ! jobar CorelDRAW/Corel DESIGNER VBA 1 24-08-2003 12:38
Detect if VBA is installed (an answer and a question) reanan CorelDRAW/Corel DESIGNER VBA 3 04-12-2002 14:35


All times are GMT -5. The time now is 17:57.


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