Author Topic: Excess white space (new lines) at the end of generated documents  (Read 2703 times)

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
Looking through the forums, this seems to be a topic that goes back many versions, but as far as I can see has not been resolved (although I note that for various old versions there have been comments that document generation has improved, but seemingly not in the area of excess white space). I've got many fragments combined together and there has always seemed to be a lot of white space in the completed document.
To test this out I have gradually reduced my template (thinking that I was doing something), but have ended up creating from scratch (based on no template) a minimal document template:

package >
{Pkg.Name}
< package

There are no spare lines (it starts with the p of the first package and ends with the e of the second package).

The result (and I've tested with EA versions 14.1, 15.2 and 16.1) is that after the package name are two blank lines. This means that for every fragment combined into a final Word document, there are two spare lines between each package name. If I (manually) delete the two blank lines then the fragments combine perfectly in Word with no gaps between the package names of two different document fragments. Given the number of other forum posts I'm surprised that this has not been raised as a bug (which I am about to do) but has anyone identified a work-around (something that does not require the user to manually edit every fragment every time they regenerate it)?

I've looked through a sample complete document and can see that there are either two or three blank lines (I've not checked but where there are three then maybe that I have caused that through the construction of my template and one more unnecessarily - I was starting from the premise that maybe I was doing something that was causing the excess white space). So this seems consistent for all the fragments.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Excess white space (new lines) at the end of generated documents
« Reply #1 on: March 01, 2023, 09:32:34 pm »
Which version are you using?

We are still on v15.2 because of all the bugs in the document generator in v16.

I did not notice this particular case though.

Geert

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
Re: Excess white space (new lines) at the end of generated documents
« Reply #2 on: March 01, 2023, 10:34:46 pm »
I've tested with EA versions 14.1, 15.2 and 16.1 - all the same result.
I've also noticed (and reported) the bugs around heading level being wrong with V16 - some but not all have been fixed so far. So yes I currently recommend users to stick with 15.2.
I'm using the DOCX output (forgot to state that before). Just checked and it's the same with RTF.
Finally, just in case there was something hidden (I had generated my model from a wizard and also have document generation setup from model document elements) I have created a blank model (using 15.2), one package and re-created the template from scratch again and generated the fragment directly from the project browser, but no difference. What I have noticed now in Word is that the final line changes settings. The Package Name and the next line is Times New Roman 10 point font and the second blank line is Arial 12 point. The first font depends on the stylesheet (I had a custom one selected initially which specified the Calibri font, but setting that to None results in the Times New Roman 10 point as specified in the test template) but no idea where the line with Arial 12 is specified.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13288
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Excess white space (new lines) at the end of generated documents
« Reply #3 on: March 01, 2023, 11:45:03 pm »
I just tested this, and indeed, I see the same two empty lines, with different sizes.

In v16.1.1624 I only get the error:

Quote
01/03/2023 13:43:53
ADODB.Fields [0x800a0cc1]

Item cannot be found in the collection corresponding to the requested name or ordinal.

Context:
   select t_object.* FROM ((t_object LEFT JOIN t_diagramobjects ON t_object.Object_ID = t_diagramobjects.Object_ID) LEFT JOIN t_object t_object_1 ON t_object.Classifier = t_object_1.Object_ID) INNER JOIN t_package ON t_package.Package_ID = t_object.Package_ID where t_object.Object_Type='Package' and ( ( t_object.PDATA1 IN ('5219','5220','5222') ) )
   GetStringVal( "ClassName" )

Geert

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
Re: Excess white space (new lines) at the end of generated documents
« Reply #4 on: March 02, 2023, 01:11:24 am »
I've figured out a workaround to get rid of one new line (so that halves the white space). If the template is changed to:

package >
{Pkg.Name} < package

There MUST be a space between the end of the template text (in this case {Pkg.Name}) and the start of <package, otherwise the output is literally {Pkg.Name} without any substitution occurring. That gets rid of the new line in the style matching the template definition. It leaves a line at Arial 12 point on the end (and I can find nothing defined in either the Normal.RTF or the Stylesheet that defines this font so it seems to be something EA is unnecessarily inserting on the end of every fragment.

Fingers crossed that if I modify all my templates that all doc generation still works as expected.

PeteC

  • EA User
  • **
  • Posts: 91
  • Karma: +1/-0
    • View Profile
Re: Excess white space (new lines) at the end of generated documents
« Reply #5 on: March 02, 2023, 02:45:23 am »
That workaround only works in the simple case illustrated. In more complex templates it doesn't achieve the reduction in white space. In particular it doesn't work when fields are populating a table, which a lot of mine are. Nor does it seem to work when many sections are included from the model, not quite sure why.

jfzouain

  • EA User
  • **
  • Posts: 151
  • Karma: +6/-1
    • View Profile
Re: Excess white space (new lines) at the end of generated documents
« Reply #6 on: March 02, 2023, 03:11:50 am »
IMHO EA document generator is not perfect, unless you know how to use it correctly.

My best work around, after I have my document output correct, I go into word and reformat the document.
Best regards

Jose Zouain