Author Topic: RTF Generator and Automatic Fields  (Read 5767 times)

imbo

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
RTF Generator and Automatic Fields
« on: April 12, 2013, 08:35:49 pm »
Hello,

I'm using the RTF Generator to build a document. I found a way to insert very easily "Page number", "Page count" and "Date and time". When it comes to more complicate things like "author of the document", "Version number of the document", "Customizing the date format to the German culture", "name of the document"… it is needed to use a customized automated field (like in Microsoft Word).

How can I do that with the RTF Generator?

I will not "hardcode" those fields in the template, as the template must be used several times, we really need automation. Like in Word by adding {FILENAME} to get the name of the file.

Thanks


RobCDeJong

  • EA User
  • **
  • Posts: 27
  • Karma: +4/-0
    • View Profile
    • Soltegro site
Re: RTF Generator and Automatic Fields
« Reply #1 on: April 12, 2013, 10:13:18 pm »
You can put those fields in tagged values of a package. In the template you can use "valueOf" to access those fields.

cheers,
Rob

imbo

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RTF Generator and Automatic Fields
« Reply #2 on: April 12, 2013, 10:27:25 pm »
hello Rob,

Thanks for your answer.

If I add a tag value in a package I'm doing a kind of "hardcoding" for example:
If I need the "file name with full path", I have to go to the Windows Explorer, copy the path and to past it to a tag. Each time the file is moved or renamed, I will have to change that tag again. Also if I need the date and time, but with a different formatting than those proposed by default, if I use a tag I will have to change the tag "date" each time I need a refresh.

However I do not want something in the package level but in the document level. A document can contain several package.

Thanks

Ian Mitchell

  • EA User
  • **
  • Posts: 506
  • Karma: +22/-4
  • The eaDocX and Model Expert guy
    • View Profile
Re: RTF Generator and Automatic Fields
« Reply #3 on: April 13, 2013, 12:09:27 am »
This is possible with eaDocX.  :) There's a free 30-day download.
Ian Mitchell, Designer, eaDocX


www.eaDocX.com
www.theartfulmodeller.com

imbo

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RTF Generator and Automatic Fields
« Reply #4 on: April 13, 2013, 12:11:44 am »
yes thanks already see it. But can't install it at this time.

Paulus

  • EA User
  • **
  • Posts: 152
  • Karma: +0/-0
    • View Profile
Re: RTF Generator and Automatic Fields
« Reply #5 on: April 14, 2013, 04:54:18 am »
If scripting is an option use the DocumentGenerator API, and sepcifically, ReplaceField.

I created a resource on the community site that explains how to create an RTF document using this API: http://community.sparxsystems.com/resources/scripts/script-creates-rtf-document-using-documentgenerator-api

wstidolph

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: RTF Generator and Automatic Fields
« Reply #6 on: April 15, 2013, 11:53:26 am »
How about the technique used in the video on "Enhanced Reporting" (http://www.sparxsystems.com/resources/demos/reporting/webinar-20121219-enhanced-reporting.html) ... the approach there shows how to write a custom script to get the repository info into template variables (they do it in a Fragment, which is nicely reusable).

Oh, BTW, the document properties script they use to provide the MyRtfData() function is in the Fragments folder of the Example project's scripts list  ;)

Graham_Moir

  • EA User
  • **
  • Posts: 749
  • Karma: +10/-15
    • View Profile
Re: RTF Generator and Automatic Fields
« Reply #7 on: April 17, 2013, 07:33:38 pm »
Also not a full solution,  but you also have the option of creating your own "Project Constants" which are really variables and can be pulled in to an RTF document.  Yes, that's at the project level, but you can have distinct sets for different documents if you use a naming convention.  

Accessing these is not in an intuitive place though.  Bring up the "Generate Documentation" panel (F8) and you'll see one of the tabs is "Project Constants"

imbo

  • EA Novice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: RTF Generator and Automatic Fields
« Reply #8 on: April 18, 2013, 01:08:54 am »
thanks I will try with a workaround