Skip to main content
Inspiring
October 30, 2024
Question

How to release images anchored in a table cell

  • October 30, 2024
  • 5 replies
  • 574 views

I am writing a script that is intended to assign an objectStyle to images, which have been placed from Word files and are anchored within table cells. I want to first 'extract' the images from the cells by releasing the anchor.

   

This stand by doesn't seem to have any effect in this case: Solved: How break with script to anchored object release - Adobe Community - 6650519—unless I manually change the anchor properties to custom (versus Inline or Above Line), the reference script will work. I haven't been able to change this property via script, as in, for example: 

            settings.anchoredPosition = AnchorPosition.ANCHORED;
            settings.anchorXoffset = 0;
            settings.anchorYoffset = 0;

Any suggestions on how to appropriately access this property, or alternative approaches, please?

This topic has been closed for replies.

5 replies

Community Expert
October 31, 2024

Hi @Andrew24943677v30i ,

to access anchored objects inside a text cell you first have to loop the page items in the text of a cell.

To gather them for a single text cell:

var anchoredItemsArray = cell.texts[0].pageItems.everyItem().getElements();

Now loop the array, change the anchor position and release the anchored object:

for( var n=0; n<anchoredItemsArray.length; n++ )
{
anchoredItemsArray[n].anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED;
anchoredItemsArray[n].anchoredObjectSettings.releaseAnchoredObject();
};

 

Note: you could be in trouble if the anchored object is part of overset text.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Inspiring
October 31, 2024

Thank you for the suggestions, I'll try again today.

Robert at ID-Tasker
Legend
October 31, 2024

Do you want to just remove image from table cell and have it somewhere on the page / spread or in the same location?

 

Inspiring
October 31, 2024

This approach could work. I see that the duplicate() command is greyed out when doing it manually, so I might assume that is not available to me in this case. Are you proposing use of the clipboard or some other means?

Robert at ID-Tasker
Legend
October 31, 2024

@Andrew24943677v30i

 

Yes, Cut, select nothing, paste.

 

It might not be the most elegant solution - but depends on what you want to achieve - might be the most efficient - you can paste then move to a desired position - create a "gallery" on a page - or paste into a new Story, etc. 

 

Any chance you would be interested in a paid solution - no coding experience needed and you can automate a lot more? As long as you work on a PC.