Hi,

Le 24/02/2018 à 20:03, Dave Stevens a écrit :
I'm using the version in the subject line on Linux Mint. In calc if I
insert the date using the insert menu and the date option I get a cell
with today's date, formatted comprehensibly. If I do the same thing in
Writer I can't, the option isn't there. I must (as far as I know)
choose field then date. That gives me text that looks like "Date
(fixed)" which is not what I want. I can do a print preview and see
that it will render as one might wish but that's not what I want. I
really want to be able to simply insert today's date as a character
string.

I think the behaviour I'm seeing breaks wysiwyg.

Can anyone tell me a simple way to insert the data as characters rather
than a field?

not exactly what you're looking for, but here we go: as the shortcut to get a date in a Calc cell is Ctrl + ; you might duplicate that behaviour in Writer.

Here's how: create a new shortcut that does that, too.

In Writer:
1. Go to Tools > Customize
2. Select the Keyboard tab
3. Check that Writer is the option selected (top right radiobutton)
4. In the Shortcut keys panel, select the Ctrl + ; shortcut
5. Select :
category: Insert
function: Date
6. Click Modify
The selected shortcut appears in the Keys panel
7. OK

From now on, hitting Ctrl + ; in Writer inserts a date field (yes, sorry).

Now, if you want to actually insert a string, you'll need a macro :

1. Add the following macro to MyMacros & Dialogs.Standard.Module1 (for instance)

8< --------------------------------------------
Sub InsertTodaysDate()

        Dim oVCur As Object     'visible cursor
        Dim oWCur As Object     'writing cursor
        Dim l_Str As String

        'get the date   
        l_Str = CStr(Date)
        'get the view cursor
        oVCur = ThisComponent.CurrentController.ViewCursor
        'set a writing cursor at the visible cursor place
        oWCur = oVCur.Text.CreateTextCursorByRange(oVCur)
        'write...
        oWCur.String = l_Str
        
End Sub 'InsertTodaysDate
------------------------------------------- >8

2. Set the shortcut (as shown above) to the said macro, with
category: select LibreOffice Macros > MyMacros > (your macro library) > (your macro module)
function: your macro name


Now Ctrl + ; inserts todays date at the cursor position.


HTH,
--
Jean-Francois Nifenecker, Bordeaux


--
To unsubscribe e-mail to: [email protected]
Problems? https://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: https://wiki.documentfoundation.org/Netiquette
List archive: https://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

Reply via email to