Ask Your Question
0

How to add name and date field of creator and date of creation in Draw template?

asked 2019-03-14 11:42:23 +0200

asgmbh gravatar image

I think this is a bug? In my opinion the documentation and reality differ.

What I want: The user opens (not right-click) an otg-file (template) as a blank unnamed file. Inside this file his name and the date of creation are inserted.

Fields for Date (fix) and Author (fix) are added. But when the user creates the file, my name and the date I created the template are inserted. Also fields for Date (variable) and Author (variable) are added if another user wants to make changes to the document.

Any idea? And why do we have more fields we can add in Writer than in Draw? Should not make the complete suite make use of all fields?

TIA

edit retag flag offensive close merge delete

Comments

(I know Calc better than Draw.)
Many things are implemented differently for components of different types. This even applies to contained objects supporting generally provided uno services.
In Calc, e.g, hyperlinks are treated as TextFields while Writer treats them as ordinary TextPieces with respective attributes. On the other hand all the other kinds of TextFields used in Writer aren't offered for inserting/editing by the UI in Calc. A date inserted via the UI into a Calc cell is an ordinary number displayed applying the locale (mostly absurd) format. Nonetheless in LibO 6 you can insert a date (fix or not) into a text contained in a spreadsheet cell as a real TextField by user code (but without a master fiied registering it as "dependent").
Not so in AOO. The fact may show us that someone of the LibO developers is working to find a way to unify ...(more)

Lupp gravatar imageLupp ( 2019-03-14 13:04:42 +0200 )edit

Fixed content: Inserts the field as static content, that is, the field cannot be updated. Fields with fixed content are only evaluated when you create a new document from a template that contains such a field. For example, a date field with fixed content inserts the date that a new document was created from the template.

This is taken from the documentation. If I understand this correctly then Draw is misbehaving in this case.

asgmbh gravatar imageasgmbh ( 2019-03-14 13:41:27 +0200 )edit

I meanwhile wasted an hour trying different ways to understand how Draw/Impress (V 6.2) are handling what originally was inserted via >Insert>Field.
I neither could find TextFields as actual content/TextPiece of such a document anywhere (element accessible from a container? enumeration of a text property? current selection? ...) nor could I find any applicable documentation or ...
It's a glorious mess as I see it.

Lupp gravatar imageLupp ( 2019-03-14 14:02:06 +0200 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-03-14 14:53:56 +0200

Lupp gravatar image

updated 2019-03-14 14:58:27 +0200

(Referring to the comments above)
Well, another half hour, and i found what I should have tried anyway: The .Text of a shape is enumerable on a first level which enumerates content supporting the paragraph service. For the paragraph a second level level of enumeration gives access to SvxUnoTextRange objects being similar to what are TextPiece objects in Writer, and supporting services of the com.sun.star.style.CharacterProperties family. Again strange for me: These objects also have a TextField property which may be Null or an actual TextField with the data of DateTimne e.g. and everything needed.
The way this works is again very different from how it is in Calc (concerning hard line breaks e.g.).
Anyway: I now know how to handle a TextField in Draw by user code. It's a shame that there is no useful application, is there?

Anyway: I could only test with a fix time field yet. It did not update when a new Draw document was created from the template I had made. It's a bug.
I will patiently wait now for the next day to also test for a probable updating of the date field, and to file a bug report then if needed.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-03-14 11:42:23 +0200

Seen: 18 times

Last updated: Mar 14