Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Stenvang on September 22, 2014, 05:11:28 pm

Title: Copying fields with numbering in - numbering fails
Post by: Stenvang on September 22, 2014, 05:11:28 pm
When I'm using the element.Notes command it copies all the text written in the notes field which is good. However this fails if the text contains numbering.
I got the following description in the notes field of an element:

1. Do work
2. Report work
3. Work done

What I what is to put this in a table in word. So I use the following code:
table.Cell(1, 2).Range.Text = element.Notes;
which inserts the following text into the cell:

<ol>
      <li>Do work</li>
      <li>Report work</li>
      <li>Work done</li>
</ol>

Any suggestions?
Title: Re: Copying fields with numbering in - numbering f
Post by: qwerty on September 22, 2014, 05:55:10 pm
There are two methods namely GetFormatFromField and GetFieldFromFormat in the repository object.

q.
Title: Re: Copying fields with numbering in - numbering f
Post by: Stenvang on September 22, 2014, 06:08:06 pm
They both contain a "string format" parameter which I don't know how to set.
Title: Re: Copying fields with numbering in - numbering f
Post by: Geert Bellekens on September 22, 2014, 06:41:40 pm
You can use getformatfromfield() to get RTF or HTML or TXT format of the notes.
You can then use that to put it into the word document.

(its all explained in the help file, you just have to read it)

Geert
Title: Re: Copying fields with numbering in - numbering f
Post by: qwerty on September 22, 2014, 07:54:42 pm
To make it a bit more clear: supply either "TXT", "HTML" or "RTF" as string parameter for the format.

q.