Skip to main content
Known Participant
June 12, 2008
Question

[CS3][VB] Invalid object GeometricBounds in table cell

  • June 12, 2008
  • 8 replies
  • 830 views
Hello,

the following VB code is working in InDesign CS2, but not in CS3:

' objElem is a text from a table cell and now I place an image
Set pic = PlaceImage(objElem.InsertionPoints.Item(posS + i), strPicPath)

' In the next line I get the Error: Invalid object for this request
GB = pic.GeometricBounds

This gives not always an error. Sometimes it is working in CS3. I think it depends on the image size.

Is there a problem in CS3 when using GeometricBounds in this way?
I know Adobe changed something in the GeometricBounds function in CS3.

Best regards

Harald
This topic has been closed for replies.

8 replies

Known Participant
October 9, 2008
1. get the image size by external program or just import agin in any spread to get the width and height;
2. use scale to resize the image to you needed size.

jxswm
Participant
October 9, 2008
We're having the same issue here somewhat.

We populate our pages through XML retrieved from a database. We include attributes to designate placement, width and height of images. All works fine as long as the images are out of a table.

When images are inside the table (regular table being created through the XML import) the images tend to be too big and go into overset in the cell. With our script we try to set the geometric bounds of the image but when the image is in overset, you cannot grab the geometric bounds. The script works fine when the image is not in overset.

We understand the suggested solution of putting the image in a rectangle in the cell, but how does XML support this?

item.parent.geometricBounds=gb;

Solutions are greatly welcomed since this gave us gray hair already ;-)
Known Participant
June 17, 2008
Hello Dave,

thank you for this hint. I will try!

If it not works, then I place the image somewhere on the page, get the size and move the image to the cell.

Harald
Inspiring
June 17, 2008
Have you tried using the trick I described and then getting the geometricBounds of the image? That should give you the information you want. As long as the image is not in overset text, you should be able to get those bounds.

Dave
Known Participant
June 17, 2008
Hello Dave,

thank you for your quick response. It works!

But now I have the problem, that some cells should fit to the images. I have to access the GeometricBounds to get the image size. But then I get the error. Is there any workaround?

Thank you

Harald
Inspiring
June 17, 2008
First add a rectangle as an inline to the cell that is the right size, then place the image in that and use fit on the image to make it fit in the rectangle. This way, you don't need to access the geometricBounds of the image.

Dave
Known Participant
June 17, 2008
Hello Dave,

yes, you are right! I place an image in a table cell. And the image size is bigger than the cell size. When I read the GeometricBounds properties, I get the error.

I want to place an image in a cell and then resize the image to the cell size. Is there any workaround?

Best regards

Harald
Inspiring
June 12, 2008
Harald,

This is a change in functionality between CS3 and CS2. In CS2, you'd get bad (but internally consistent) values for the geometric bounds of item in cells in an overset part of a table. In CS3, you get the message you're seeing. So, if your image is of such a size as to push its containing cell overset, then that will explain why you only get the message for larger images.

Dave