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

Page number does not work

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Marcus.Geldern
General User
General User


Joined: 28 Feb 2004
Posts: 8
Location: Europe, Germany, NRW, Geldern

PostPosted: Mon Mar 01, 2004 8:38 am    Post subject: Page number does not work Reply with quote

My VBScript for page numbers doesn't work. There's no page number on the first page Crying or Very sad Using OOo Writer without VBScript works. So what's wrong?

Code:
'insert page numbers
'problems: a) doesn't work on 1st page!; b) footer is 0,5cm too high.
set OOo = CreateObject("com.sun.star.ServiceManager")
set Writer = OOo.createInstance("com.sun.star.frame.Desktop")
Set doc = Writer.loadComponentFromURL("private:factory/swriter", "_blank", 0, Array())
Set text = doc.getText
'set c = text.createTextCursor

set PageNumber = doc.createInstance("com.sun.star.text.TextField.PageNumber")
PageNumber.NumberingType = 4 ' com.sun.star.style.NumberingType.ARABIC

set PageStyle = doc.StyleFamilies.getByName("PageStyles")
Set StdPage = PageStyle.getByName("Standard") 'name could be 'Default' in English
StdPage.FooterIsOn = True

With StdPage.FooterText.Text
  Set FooterCursor = .createTextCursor()
  FooterCursor.ParaAdjust = 3 'CENTER
  .insertTextContent FooterCursor, PageNumber, False
End With
Back to top
View user's profile Send private message
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Tue Mar 02, 2004 3:28 pm    Post subject: Re: PageNumber Reply with quote

Hi,

Set property SubType to 1:

Code:

PageNumber.SubType = 1 ' com.sun.star.text.PageNumberType.CURRENT


Bye.

Danad.
Back to top
View user's profile Send private message
annavonbreslau
Newbie
Newbie


Joined: 30 May 2005
Posts: 2

PostPosted: Wed Jun 08, 2005 12:23 am    Post subject: Re: Page number does not work Reply with quote

Marcus.Geldern wrote:
My VBScript for page numbers doesn't work. There's no page number on the first page Crying or Very sad Using OOo Writer without VBScript works. So what's wrong?

Code:
'insert page numbers
'problems: a) doesn't work on 1st page!; b) footer is 0,5cm too high.
set OOo = CreateObject("com.sun.star.ServiceManager")
set Writer = OOo.createInstance("com.sun.star.frame.Desktop")
Set doc = Writer.loadComponentFromURL("private:factory/swriter", "_blank", 0, Array())
Set text = doc.getText
'set c = text.createTextCursor

set PageNumber = doc.createInstance("com.sun.star.text.TextField.PageNumber")
PageNumber.NumberingType = 4 ' com.sun.star.style.NumberingType.ARABIC

set PageStyle = doc.StyleFamilies.getByName("PageStyles")
Set StdPage = PageStyle.getByName("Standard") 'name could be 'Default' in English
StdPage.FooterIsOn = True

With StdPage.FooterText.Text
  Set FooterCursor = .createTextCursor()
  FooterCursor.ParaAdjust = 3 'CENTER
  .insertTextContent FooterCursor, PageNumber, False
End With
Code:
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