Book a Demo

Author Topic: Render the EA notes format in external formats?  (Read 13184 times)

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Render the EA notes format in external formats?
« on: August 05, 2013, 10:01:20 pm »
When I create SQL reports from the EA repository, i of course get the raw formatting tags in the notes field.
Does anyone know of formating methods/libraries/conversion formulas to render the EA notes format in external formats properly.

I realize that half the formula depends on the output format.
I need to render it in MS Word, HTML, excel, and plain text

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Render the EA notes format in external formats
« Reply #1 on: August 05, 2013, 10:13:51 pm »
The API contains two operations to switch between formats.
Repository.GetFieldFromFormat and Repository.GetFormatFromField

Geert

Stefan Bolleininger

  • EA User
  • **
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: Render the EA notes format in external formats
« Reply #2 on: August 06, 2013, 04:15:30 am »
Hi Geert,

if you wouldn't be male and so far from me, I really would like to Kiss you!

The EA formatting behaviour was drivven me mad and now how to handle it.

Thanks

Stefan
Enterprise Architect in "safetycritical development" like medical device industry. My free Add-in at my Website

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Render the EA notes format in external formats
« Reply #3 on: August 06, 2013, 05:06:21 am »
You could have asked me. But please don't kiss me either :-)

q.

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: Render the EA notes format in external formats
« Reply #4 on: August 06, 2013, 05:30:52 am »
Thanks.
I had not seen those.

I will have a look at them when I get into my office tomorrow.

I was thinking of something I could use externally to EA - in SQL or in the report processing (perhaps regular expressions or libraries if the EA format is a subset of some standard).

I never succeeded i using the EA Windows automation interface from Java.

Was what you had in mind, that I call those functions from outside of EA - - like from a report builder?

Stefan Bolleininger

  • EA User
  • **
  • Posts: 308
  • Karma: +0/-0
    • View Profile
Re: Render the EA notes format in external formats
« Reply #5 on: August 06, 2013, 05:47:12 am »
I never thought about asking because it seemed to unworthy :-)
Enterprise Architect in "safetycritical development" like medical device industry. My free Add-in at my Website

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Render the EA notes format in external formats
« Reply #6 on: August 06, 2013, 05:56:57 am »
Quote
Thanks.
I had not seen those.

I will have a look at them when I get into my office tomorrow.

I was thinking of something I could use externally to EA - in SQL or in the report processing (perhaps regular expressions or libraries if the EA format is a subset of some standard).

I never succeeded i using the EA Windows automation interface from Java.

Was what you had in mind, that I call those functions from outside of EA - - like from a report builder?
Sure you can use these from an external report builder. I guess you need a dummy repository so you have the Repository object at hand.

However, you should also succeed with a regex. IIRC I did so in the past. The format is quite simplistic. And if you're unsure you could write a short test program to let EA do a conversion and see what happens. Finally you need to map just the formats you see as icon in the Notes RT editor.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Render the EA notes format in external formats
« Reply #7 on: August 06, 2013, 03:59:39 pm »
The downside of using something like a regex is that it would have to be changed in case EA decides to change something to their internal format (or add a feature such as font, or tables, or size, ...)

If you are using the API function provided by Sparx you can expect those new features to be supported by the API. (and if not you can file a bug report).

So if at all possible I would try to use the API.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Render the EA notes format in external formats
« Reply #8 on: August 06, 2013, 07:32:36 pm »
Geert is right. Alas, the format has not changed since 10 years. And Sparx is very, very conservative in what they do.

q.

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: Render the EA notes format in external formats
« Reply #9 on: August 06, 2013, 10:20:48 pm »
Thanks, it got the right output now.

I found out that the MS Report Builder that I started to use this week actually covers it with an HTML render and then when the report is saved as either MS Word or HTML it works fine  :)

But I will keep both the API methods i mind for future use.

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: Render the EA notes format in external formats
« Reply #10 on: August 06, 2013, 10:50:35 pm »
A warning of course:
Ups, of course, I do need to check up on this very soon the see if that MS Report function actually includes some HTML encoding for non-white-listed tags  :-?)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Render the EA notes format in external formats
« Reply #11 on: August 06, 2013, 11:16:52 pm »
I strongly suggest to use the both API functions.

The EA internal format looks a bit like HTML, but it isn't really, so you could get some funny results trying to interpret it with something else.

Geert

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: Render the EA notes format in external formats
« Reply #12 on: August 07, 2013, 03:59:36 pm »
You're right.
I'm losing linebreaks.
But all formatting (bullets, bold etc seems to be fine)

johann

  • EA User
  • **
  • Posts: 27
  • Karma: +2/-0
    • View Profile
Re: Render the EA notes format in external formats
« Reply #13 on: August 08, 2013, 07:29:58 pm »
We also extract the notes text directly from the database for our (XHTML based) documentation and we made the following observations:

The format of the notes field has (silently) changed during the last years. For example, in older versions of EA the string "-> Research & Development" was stored as such in the database. However, since the support of HTML markup the string is stored as "-> Research & development". If you have a long lasting project (using different versions of EA) it is likely that you have both types. Then you need to analyze the contents in order to decide if it is plain text or markup.

And yes (Geert noted this): Line breaks are significant (not like in HTML) - you have to replace them with a <br/> tag, if you want to generate HTML format. But there are also line breaks in places where you should not replace them (inside list tags).
Other whitespace is significant in the notes text, but not in HTML. Spaces get lost unless you replace them with &nbsp; characters.

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: Render the EA notes format in external formats
« Reply #14 on: August 09, 2013, 04:49:01 am »
Yes, I did make the observations about the line breaks within the list/bullets too - as well as whitespaces - in particular tabs are a challenge.

I never noticed the -> issue, even on EA 7.5 - but maybe that's due to my use of tagsoup's library for HTML encoding (with whitelists).