• Not Answered

object position and size data export

Calling all CorelDrawers!,

I am generating a series of objects in coreldraw15 that I am placing into a single layer. I am interested in extracting their X,Y coordinates as well as height values into spreadsheet (.xls) format. Any thoughts on how I might do this?

Thanks!

1 Reply - Latest Reply

  • You can try macro below, it creates file c:\corelobjects.txt with information about object on active layer. Mark “|“ (alt+0124) is used as delimiter. Txt file can be easily imported to Excel.

    sample txt file attached

     

    Sub objectdata()

    Dim sh As Shape, w#, h#, x#, y#, s As Shape, n#

    ActiveDocument.Unit = cdrMillimeter

    Set s = ActiveDocument.ActiveLayer.CreateParagraphText(1, 1, 0, 0, "pos|x|y|h|w" & vbCr)

    s.OrderToBack

    ActiveDocument.ReferencePoint = cdrCenter

    For Each sh In ActivePage.Shapes

    sh.GetPosition x, y

    sh.GetSize w, h

    i = sh.ZOrder

    Set t = s.Text

    t.Story.InsertAfter (i & "|" & x & "|" & y & "|" & w & "|" & h & "|" & vbCr)

    Next sh

    n = ActivePage.Shapes.Count

    t.ExportToFile "c:\corelobjects.txt", 1, n, cdrParagraphIndexing

    s.Delete

    End Sub

    corelobjects.txt