Re: off-list Re: [libreoffice-users] Date changes to a 5 digit number
No computer access, but my guess its that the problem its that the format is set to an integer constant. The correct method is to lookup the format index and create the format if it does not exist. I would explain more, but my phone is slow to use for this. Will have better access in a few days if needed. There is an example in andrewmacro.odt I believe. Hth Sent from my Samsung Epic™ 4G Tom Davies tomdavie...@yahoo.co.uk wrote: Hi :) Looks like the code didn't get to the list so here it is REM * BASIC * Sub Main End Sub sub Insert_Line_and_Date rem -- rem define variables dim document as object dim dispatcher as object rem -- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService(com.sun.star.frame.DispatchHelper) rem -- dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = GraphicName args1(0).Value = args1(1).Name = IsSimpleLine args1(1).Value = true dispatcher.executeDispatch(document, .uno:InsertGraphicRuler, , 0, args1()) rem -- dim args2(5) as new com.sun.star.beans.PropertyValue args2(0).Name = Type args2(0).Value = 0 args2(1).Name = SubType args2(1).Value = 0 args2(2).Name = Name args2(2).Value = args2(3).Name = Content args2(3).Value = 0 args2(4).Name = Format args2(4).Value = 5122 args2(5).Name = Separator args2(5).Value = dispatcher.executeDispatch(document, .uno:InsertField, , 0, args2()) rem -- dim args3(0) as new com.sun.star.beans.PropertyValue args3(0).Name = Text args3(0).Value = , dispatcher.executeDispatch(document, .uno:InsertText, , 0, args3()) rem -- dim args4(1) as new com.sun.star.beans.PropertyValue args4(0).Name = Template args4(0).Value = Heading 1 args4(1).Name = Family args4(1).Value = 2 dispatcher.executeDispatch(document, .uno:StyleApply, , 0, args4()) end sub Regards from Tom :) From: . l...@ebookring.net To: Tom Davies tomdavie...@yahoo.co.uk Sent: Saturday, 27 October 2012, 18:37 Subject: Re: off-list Re: [libreoffice-users] Date changes to a 5 digit number Tom, Did my code message get to the list? I know you replied with it but it seems there's no option for me to reply to the list. Thanks, Carl On 10/27/2012 01:33 PM, Tom Davies wrote: snip / From: . l...@ebookring.net To: Tom Davies tomdavie...@yahoo.co.uk Sent: Saturday, 27 October 2012, 18:29 Subject: Re: [libreoffice-users] Date changes to a 5 digit number On 10/27/2012 01:06 PM, Tom Davies wrote: Hi :) Can you copypaste the macro's code into a reply as text? If we could see the code then some people here might be able to spot the error. Good luck and regards from Tom :) Here's the code- REM * BASIC * Sub Main End Sub sub Insert_Line_and_Date rem -- rem define variables dim document as object dim dispatcher as object rem -- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService(com.sun.star.frame.DispatchHelper) rem -- dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = GraphicName args1(0).Value = args1(1).Name = IsSimpleLine args1(1).Value = true dispatcher.executeDispatch(document, .uno:InsertGraphicRuler, , 0, args1()) rem -- dim args2(5) as new com.sun.star.beans.PropertyValue args2(0).Name = Type args2(0).Value = 0 args2(1).Name = SubType args2(1).Value = 0 args2(2).Name = Name args2(2).Value = args2(3).Name = Content args2(3).Value = 0 args2(4).Name = Format args2(4).Value = 5122 args2(5).Name = Separator args2(5).Value = dispatcher.executeDispatch(document, .uno:InsertField, , 0, args2()) rem -- dim args3(0) as new com.sun.star.beans.PropertyValue args3(0).Name = Text args3(0).Value = , dispatcher.executeDispatch(document, .uno:InsertText, , 0, args3()) rem
Re: off-list Re: [libreoffice-users] Date changes to a 5 digit number
Hi :) Looks like the code didn't get to the list so here it is REM * BASIC * Sub Main End Sub sub Insert_Line_and_Date rem -- rem define variables dim document as object dim dispatcher as object rem -- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService(com.sun.star.frame.DispatchHelper) rem -- dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = GraphicName args1(0).Value = args1(1).Name = IsSimpleLine args1(1).Value = true dispatcher.executeDispatch(document, .uno:InsertGraphicRuler, , 0, args1()) rem -- dim args2(5) as new com.sun.star.beans.PropertyValue args2(0).Name = Type args2(0).Value = 0 args2(1).Name = SubType args2(1).Value = 0 args2(2).Name = Name args2(2).Value = args2(3).Name = Content args2(3).Value = 0 args2(4).Name = Format args2(4).Value = 5122 args2(5).Name = Separator args2(5).Value = dispatcher.executeDispatch(document, .uno:InsertField, , 0, args2()) rem -- dim args3(0) as new com.sun.star.beans.PropertyValue args3(0).Name = Text args3(0).Value = , dispatcher.executeDispatch(document, .uno:InsertText, , 0, args3()) rem -- dim args4(1) as new com.sun.star.beans.PropertyValue args4(0).Name = Template args4(0).Value = Heading 1 args4(1).Name = Family args4(1).Value = 2 dispatcher.executeDispatch(document, .uno:StyleApply, , 0, args4()) end sub Regards from Tom :) From: . l...@ebookring.net To: Tom Davies tomdavie...@yahoo.co.uk Sent: Saturday, 27 October 2012, 18:37 Subject: Re: off-list Re: [libreoffice-users] Date changes to a 5 digit number Tom, Did my code message get to the list? I know you replied with it but it seems there's no option for me to reply to the list. Thanks, Carl On 10/27/2012 01:33 PM, Tom Davies wrote: snip / From: . l...@ebookring.net To: Tom Davies tomdavie...@yahoo.co.uk Sent: Saturday, 27 October 2012, 18:29 Subject: Re: [libreoffice-users] Date changes to a 5 digit number On 10/27/2012 01:06 PM, Tom Davies wrote: Hi :) Can you copypaste the macro's code into a reply as text? If we could see the code then some people here might be able to spot the error. Good luck and regards from Tom :) Here's the code- REM * BASIC * Sub Main End Sub sub Insert_Line_and_Date rem -- rem define variables dim document as object dim dispatcher as object rem -- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService(com.sun.star.frame.DispatchHelper) rem -- dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = GraphicName args1(0).Value = args1(1).Name = IsSimpleLine args1(1).Value = true dispatcher.executeDispatch(document, .uno:InsertGraphicRuler, , 0, args1()) rem -- dim args2(5) as new com.sun.star.beans.PropertyValue args2(0).Name = Type args2(0).Value = 0 args2(1).Name = SubType args2(1).Value = 0 args2(2).Name = Name args2(2).Value = args2(3).Name = Content args2(3).Value = 0 args2(4).Name = Format args2(4).Value = 5122 args2(5).Name = Separator args2(5).Value = dispatcher.executeDispatch(document, .uno:InsertField, , 0, args2()) rem -- dim args3(0) as new com.sun.star.beans.PropertyValue args3(0).Name = Text args3(0).Value = , dispatcher.executeDispatch(document, .uno:InsertText, , 0, args3()) rem -- dim args4(1) as new com.sun.star.beans.PropertyValue args4(0).Name = Template args4(0).Value = Heading 1 args4(1).Name = Family args4(1).Value = 2 dispatcher.executeDispatch(document, .uno:StyleApply, , 0, args4()) end sub From: . l...@ebookring.net To: users@global.libreoffice.org Sent: Saturday, 27 October 2012, 17:59