Page 1 of 1

Convert DateTime fields to ordinary text portions

PostPosted: Wed Oct 10, 2018 12:51 pm
by Lupp
By a question in a different forum Iwas pointed to the fact that TextFields, in specific DateTime fields addressed there, are not found by a search if matching the 'Search for' string.

I took the oportunity to consider this, and tend to judge that behaviour to be a "heritage bug". A textcursor spanning the range of the field is knowing the string well. It should not be to difficult to include it when searching.

Anyway some person writing a diary or minuting a discussions may want to insert dates or times as fields using a shortcut. The person may then want to be able to search for some of the inserted fields. Difficult thing?

It gets rather simple if the person decides to definitely convert the DateTime (date or time) fields to ordinary text portions. How to do so for a complete text document in Writer, including any substructures (frames, tables, nested specimen of these kinds; shapes don't accept TextFields) by a few lines of code is demonstrated in the attached example.
(31.83 KiB) Downloaded 54 times

If there is an additional need to harmonize the formats (two classes for dates and times e.g.) or to convert Time fields to DateTime fields in advance of conversion, please report your case. I'm not the most important user of this tool. As it is presented here, the number formats and the text formats as well are preserved.

Re: Convert DateTime fields to ordinary text portions

PostPosted: Wed Oct 10, 2018 1:33 pm
by JeJe
The Edit Fields dialog box isn't very good. Perhaps not difficult though to make an alternative one that lists all the date fields at once.

A custom character style could be used for dates.