Author Topic: Inserting text into a table cell EA through API  (Read 8280 times)

vkc1020

  • EA Novice
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Inserting text into a table cell EA through API
« on: September 11, 2019, 10:38:26 am »
Hello!

I was wondering if it would be possible to insert custom text into a table cell in a custom template while automating document generation.
I checked https://sparxsystems.com/enterprise_architect_user_guide/14.0/automation/document_generator_interface_class.html but I did not find much.

Thank You!

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1324
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Inserting text into a table cell EA through API
« Reply #1 on: September 12, 2019, 02:03:58 pm »
The only way I can think of is to replace a field using ReplaceField().
Happy to help
:)

markus8521

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Inserting text into a table cell EA through API
« Reply #2 on: July 22, 2025, 09:30:16 pm »
Hi vkc1020,

yes that's possible. As documented here: https://sparxsystems.com/enterprise_architect_user_guide/17.1/add-ins___scripting/document_generator_interface_class.html you can use the DocumentGenerator Method "DocumentCustomData". The 1st argument is a string in the format of an xml-file. The associated link on the page is a bit misleading. Use his one instead: https://sparxsystems.com/enterprise_architect_user_guide/17.1/model_publishing/example_output_of_an_rtf_templ.html
The xml-string has to follow the xml-structure shown there. Each of your data entries that you want to be shown with the template later is a line in the xml-string with a begin-tag, content and an end-tag (e.g.:  <Tag>Content</Tag>).
Next, in the document template in EA you insert a custom section. In there, with a right-click you insert a custom field. In the example above, your custom field text is simply "Tag". When you have followed the xml-structure above, the EA document generator will replace the custom field "Tag" with "Content" in your generated document.
For additional data, hust add additional data to your xml-string and custom fields to your document template.

I hope this is the answer you were looking for.