Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - Screwtape

Pages: 1 ... 3 4 [5] 6 7

I had written a script in EA 11 which worked brilliantly. When I called DocumentElement for a full template, it bookmarked the element with it's GUID. In EA 12, it appeared to bookmark the element incorrectly. In 12.1 it's working better again, except where I reference the element more than once.

It appears, that if I have element X referred to (as a custom fragment via a specific template) in the document, and then document element X again using a normal template, the start bookmark is the first time I referred to it, and the end bookmark is the end of the second time I document it.

Is there any way of preventing the engine from bookmarking the references from the custom fragment?
(I manually generate a table which includes bookmarked references to the main entry for the element, which worked beautifully in EA 11, but hasn't worked properly since. The custom fragment reference could be before or after the main entry.)

Any suggestions gratefully received.


Automation Interface, Add-Ins and Tools / What is the scope of ReplaceField?
« on: September 16, 2015, 11:05:27 pm »
I'm using the EA12 (1215) document generator API to create some documentation. I've a situation where is would be very useful to replace the field value for one or two fields within a template in a particular situation, so I've tried the following JScript fragment:

Code: [Select]
generationSuccess = docGenerator.DocumentElement( connectedElement.ElementID, level, PROCESS_TEMPLATE );
if ( !generationSuccess )
  ReportWarning( "Error generating process documentation: " + docGenerator.GetLastError() );
generationSuccess = docGenerator.ReplaceField("Element.Name", "Method: " + method.Name );
if ( !generationSuccess )
  ReportWarning( "Error replacing field: " + docGenerator.GetLastError() );

However, it doesn't seem to replace the field, or give any error. What it does seem to do is truncate the document at the point I call ReplaceField

I don't understand the scope of the ReplaceField method, since wherever I put it, it either breaks the document, or does nothing.

The only reason I could think of for this not doing anything, is that the template calls fragments in which the `Element.Name` field was referenced, but having converted the fragment to a template and called it explicitly, ReplaceField still seems to do nothing.

Does anyone have a good example piece of script that uses ReplaceField effectively with element data fields?

The ACMEContextDocumentGenerator example I've found so far only uses ReplaceField on a single document level custom data field, which is not what I'm trying to do.

Any pointers or suggestions would be greatly appreciated, since I've tried everything I can think of.

Tried using DOCX generation instead of RTF.

The same issues seem to be happening. The bookmarks are in the same places as before, and the diagrams are not sizing correctly - see

It looks like the document generator isn't working quite correctly when called from the API.


That's using Google for you! I'd just Googled the class name and I hadn't noticed the hit it gave me was from 9.2 which may explain why the API seemed so far behind the normal functionality!

Maybe I'll have less issues now... I'll give it a go! :)


Hi Monsieur,

As I'm using the DocumentGenerator class, it doesn't allow you do save as docx, just RTF or HTML.

SaveDocument (string filename, long nDocType)


Saves the document to disk.

     filename: String - the filename to save the file to
     nDocType: Long - 0 = RTF, 1 = HTML

Is there a way to save to docx using the API?



Hi! Thanks for that. I've upgraded to 1214 and it's still doing the same thing I'm afraid. Is it worth raising (or re-raising) as a bug?

Interestingly, if there is a diagram displayed as part of the element, the bookmark now links to the diagram, rather than the whole element as it used to.

I was using the bookmarks to reference other sections in the generated document, but that doesn't work now, and I can't see any other way to do it.



I've upgraded from EA11 to EA12, and since doing so, when I generate documentation, using a custom script and custom fragments, I note that the bookmark that had the element's GUID and used to surround the element, now appears to start and end at the end of the element's title.

This means that the bookmark now cannot be used for constructing references. (i.e. see paragraph 3.4)

Does anyone know why this has changed, or how to get it to work the way it used to?


I'm afraid this doesn't help you, but I think it's a bug introduced in a recent upgrade, since it used to work fine for me, but I get the same issue now. I have to manually rescale all my diagrams after generating which is a real pain.

(To be fair - I'm using DocumentElement but it does the same thing with attached diagrams)

It may be worth raising a bug report.




Is there a way to pass a null value, rather than an empty element, in a custom script XML?

If I define a row without, say a "Name" element, the output from the custom fragment is to show "Name". If I create a <Name/> element, the fragment "prints" the blank - but includes the headings and space I'd like to remove with bookmarks.

Is there any way of having an optional custom field and using bookmarks with it, like you can with normal fragments?



But that won't scale correctly either... would it?

If I'm trying to do this...
 ( ( )
( ( )
( ( )
 (____________________( )
i need the curved lines to be roughly 1/4 to 1/5 the width of the overall height of the shape, regardless of the width of the overall shape. A surely bitmap either woudn't change height, or would scale in both axes independently.

It's practically useless then, and rather explains the lack of a decent cylinder icon.

All it needs is to be able to identify the size and/or aspect ratio, and perform basic arithmetic, and it would be really useful.

In the mean time, my otherwise very professional looking diagrams are let down by a lousy servicebus cylinder, that only looks approximately right if you have it precisely the right aspect ratio, which it often isn't because you need to to be long for the very reason it's a service bus.

It's bizarre, EA repeatedly lets itself down with really trivial issues.

Automation Interface, Add-Ins and Tools / Get target size in shape script.
« on: November 08, 2014, 12:48:17 am »

I'm trying to improve on the embarrassing "cylinder" used for servicebus stereotypes.

However, having read the shapescript documentation, I can't see any way of finding out the size or aspect ratio of the object being laid-out.

You also can set scaling either on, fixed aspect, or off. I've even tried to add a sub-shape with fixed aspect, within a non-fixed main shape, but that doesn't work either.

Surely there must be a way of having a shape that is proportional to only one of the axes of the drawing, rather than both. It really makes shapescript rather inadequate if there isn't.

Please tell me I'm wrong and have missed something obvious!


Does anyone know if it is possible to include an RFT tag (I'm trying to add a reference to a bookmark) in data from a custom script fragment?

I've tried adding the {\field...} in a CDATA section within the field, but this just shows the whole field as text.

Any ideas welcome...




Since a recent update (11.1 perhaps), my RTF document is generating differently. The fragment seeks to show the target of a connector, but instead the source is being shown. Has Sparx changed the definition of target and source, or is it just me?


Hi! Does anyone know if it is possible to select an image in a custom fragment from the code? I'm setting field values, but I don't think I can insert an image from the image library in to the template, or see any way of providing an image in the custom fragment xml.

Can this be done?

Pages: 1 ... 3 4 [5] 6 7