none
Relating Floating Images to Table Cells RRS feed

  • Question

  • Hi all. I have a series of documents that are being produced every month (export from Access -> PDF -> Word, to maintain formatting and images). Within these documents are a large number of tables and images. When the images are in any row of a table, except the first, they import correctly as Pictures. However, when they are in the first cell of a table, that image (and every subsequent image in that table) import as floating images - with their anchor point set to the top left corner of the page.

    I need a quick and easy way to tie these images to their relevant cell, rather than to the top of the page. It's possible to do it at an individual level by selecting the image (using the 'select object' tool) and then selecting Ungroup. This moves the anchor from the top of the page to the cell, without shifting the position of the image - meaning that any changes to the table impact that image as well. Using the same logic in VBA, with an explicit object name also works. Eg: activeDocument.Group36.Ungroup.

    However, looping through the Shapes Collection and using ActiveDocument.(Shape.Name).Ungroup doesn't have the same effect. It does ungroup the images, but it doesn't change the anchor point, or the nature of the image so that it sits in the table cell correctly. As the documents change every month, it's impossible (and poor design anyway) to hardcode the image/group names. Does anyone know of a convenient script to fix this problem (get floating images to be tied to a table cell they're already theoretically positioned inside)? Or alternatively, can anyone explain the disparity between the behaviour of explicitly referenced objects and the Shapes Collection?

    Tuesday, December 17, 2013 4:02 PM

All replies

  • Hi,

    From the Shape.Ungroup method, there is nothing about change the anchor. I also test the code activeDocument.Group36.Ungroup and x.(Shape.Name).Ungroup to ungroup the shapes in the Word 2013. Neither of them will change the anchor point.

    And as far as I know, all Shape objects are anchored to a range of text but can be positioned anywhere on the page that contains the anchor. If you specify the anchoring range when you create a shape, the anchor is positioned at the beginning of the first paragraph that contains the anchoring range. If you don't specify the anchoring range, the anchoring range is selected automatically and the shape is positioned relative to the top and left edges of the page( Refer to Shape.Anchor).

    Would you mind sharing with us the sample document to reproduce this issue? You can upload it through the skydrive.

    Best regards
    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, December 18, 2013 12:41 PM
    Moderator