OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Why is it not inserting the date but a number?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Fundi
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 278

PostPosted: Wed Oct 20, 2004 2:38 pm    Post subject: Why is it not inserting the date but a number? Reply with quote

Hi
Something is puzelling me quite a bit and I have tried to find a solution but I am afraid I am hitting the wall all the time.

I recorded a macro to create a footer that inserts among other things a date field. When I run the macro I get everything just the date is a number. Why is that so? How can I force it to be a propper formatet date?

Thanks in advance.
mj
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Wed Oct 20, 2004 5:04 pm    Post subject: Reply with quote

Provide the recorded code please.

Christian
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
Fundi
OOo Advocate
OOo Advocate


Joined: 21 Sep 2004
Posts: 278

PostPosted: Thu Oct 21, 2004 1:20 pm    Post subject: The code... Reply with quote

I hope I dont get shot down for posting so many lines of code but that is the macro as recorded. Thanks for all the trouble in answering. MJ

sub DocInfo
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 = "PageStyle"
args1(0).Value = "Default"
args1(1).Name = "On"
args1(1).Value = true

dispatcher.executeDispatch(document, ".uno:InsertPageFooter", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(5) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Type"
args2(0).Value = 2
args2(1).Name = "SubType"
args2(1).Value = 0
args2(2).Name = "Name"
args2(2).Value = ""
args2(3).Name = "Content"
args2(3).Value = ""
args2(4).Name = "Format"
args2(4).Value = 1
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 args5(5) as new com.sun.star.beans.PropertyValue
args5(0).Name = "Type"
args5(0).Value = 0
args5(1).Name = "SubType"
args5(1).Value = 1
args5(2).Name = "Name"
args5(2).Value = "1"
args5(3).Name = "Content"
args5(3).Value = ""
args5(4).Name = "Format"
args5(4).Value = 5080
args5(5).Name = "Separator"
args5(5).Value = " "

dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args5())

rem ----------------------------------------------------------------------
dim args6(0) as new com.sun.star.beans.PropertyValue
args6(0).Name = "Text"
args6(0).Value = ", Page "

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args6())

rem ----------------------------------------------------------------------
dim args7(5) as new com.sun.star.beans.PropertyValue
args7(0).Name = "Type"
args7(0).Value = 5
args7(1).Name = "SubType"
args7(1).Value = 5
args7(2).Name = "Name"
args7(2).Value = ""
args7(3).Name = "Content"
args7(3).Value = ""
args7(4).Name = "Format"
args7(4).Value = 7
args7(5).Name = "Separator"
args7(5).Value = " "

dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args7())

rem ----------------------------------------------------------------------
dim args8(0) as new com.sun.star.beans.PropertyValue
args8(0).Name = "Text"
args8(0).Value = " of "

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args8())

rem ----------------------------------------------------------------------
dim args9(5) as new com.sun.star.beans.PropertyValue
args9(0).Name = "Type"
args9(0).Value = 6
args9(1).Name = "SubType"
args9(1).Value = 0
args9(2).Name = "Name"
args9(2).Value = ""
args9(3).Name = "Content"
args9(3).Value = ""
args9(4).Name = "Format"
args9(4).Value = 7
args9(5).Name = "Separator"
args9(5).Value = " "

dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args9())


end sub
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group