Hi,
Is it possible to insert an image into a specific cell in a table in a word template?
Alternatively, is it possible to dynamically change the background colour of a specific cell in a table in a word template?
Many thanks in advance,
Tom
Hi,
Is it possible to insert an image into a specific cell in a table in a word template?
Alternatively, is it possible to dynamically change the background colour of a specific cell in a table in a word template?
Many thanks in advance,
Tom
Hello,
If the cell contains a placeholder, you can create a WordFragment with an image and replace the placeholder by the new WordFragment using replaceVariableByWordFragment.
Otherwise, if there's no placeholder to be replaced, you can use insertWordFragment from DOCXPath to insert a WordFragment to any specific position in a document, such as in a cell.
In the package and the API documentation pages you can find samples about how to use both methods.
About changing a background color of a specific cell, if you are creating the table dynamically you can set cell backgroud colors using addTable or embedHTML. But if you need to change the background color of a cell in an existing table in a template you need to use customizeWordContents from DOCXCustomizer, but it's only available in Premium licenses.
Regards.