Hello,
I still have a question about fields.
The thing is I have to convert an existing Word macro in VBA into the same thing, written in Basic for LibreOffice.
In the VBA macro, there’s a window with a list and a button, and when you select an element on the list and click on the button, it inserts a pair of fields inside the document. The inserted fields look like this :
{<SECTION COMPOSITION>} {</SECTION COMPOSITION>}
These fields are not meant to be replaced by anything, they’re just like containers. And each container will be able to contain specific fields.
To do that, I have another window, containing a list of fields, and when the user clicks on a field and clicks on validate, it will insert the field in the document.
If the cursor is placed outside of the “SECTION” then no field can be added.
And depending on the cursor, certain fields can be added and not others. This means that if the cursor is inside the “COMPOSITION SECTION” like above, then some specific fields will be shown and only these fields will be inserted. I’m not sure if I’m very clear…
I’m explaining all that so that you have a full understanding of what I’m trying to achieve.
Thanks to @KamilLanda I was able to insert the sections inside the document. But what bothers me is the way it’s displayed… If I take the example of “composition” like above, when it’s inserted inside my LibreOffice document, it looks like this :
Champ d'utilisateur SECT_COMPOSITION= Champ d'utilisateur SECT_END_COMPOSITION=
I was not able to create custom fields with opening and closing tags, I don’t know why, so I had to make them a little different : the opening field will be normal and the closing one will have the “END” word in it.
But they’re preceeded by the word “Champ d’utilisateur” which means “User field”, and they’re both followed by the equal sign…
So when you look at the document, these fields really look like fields to be replaced, and not section tags…
Do you understand what my issue is ?
Is there a way to do it differently ? Maybe another type of fields that I’m not aware of ?
I can give you the VBA code if needed, it may be clearer for a better undertanding ?
I hope you’ll be able to help me
Thanks.