Forum


Replies: 4   Views: 690
Is it possible to use content control images?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by kronholm  · 01-09-2022 - 12:06

I've just made some successful tests with modifyInputFields($data), to replace some text in a document containing plain text Content Controls.

But how would one go about changing Content Control Images?

Posted by kronholm  · 02-09-2022 - 09:17

Regular images with the placeholder variable name as alt text works, but not quite what I need.

I'm after is using content controls, which use label/key for identifying, and that doesn't seem to work with replacePlaceholderImage, nor does the documentation mention it works with content controls.

Is there an example of replacing images in document for content control image?

Edit:

Reason I need it, instead of using the alt-text method, is that it would take a lot more time to explain to users both how to use content controls, and now also having to use alt-text. I quickly gets confusing and overwhelming for non-word-experts.

Posted by admin  · 02-09-2022 - 09:38

Hello,

A picture content control can include an alt text content so it can be used with replacePlaceholderImage to replace the image. Sorry, but the current stable version doesn't include a method to replace a picture content control by the title or tag value of a content control.

The modifyInputFields method only replaces input contents such as rich text content controls; so a new method should be generated for picture content controls. We have added a new task to add it in a future release of phpdocx.

Regards.

Posted by kronholm  · 02-09-2022 - 09:41

Thanks for taking the time to explain, I understand.

The purpose of using content control and it's alias/key is kind of defeated if you also have to enter it in the alt-text. The alt-text is there for another purpose - screen readers - not sure how it'll act with variables in there, but guess I'll find out.. Seems like a bit of a hack currently, but I also realize why you'd do that initially :)

Sadly I'm on Advanced license, so I will not be benefiting from the added feature in the future.