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

Single-page ott: Add # to 1st page in case of 1+n page odt?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
ltg73
General User
General User


Joined: 04 Jun 2006
Posts: 32

PostPosted: Tue Jun 06, 2006 5:44 am    Post subject: Single-page ott: Add # to 1st page in case of 1+n page odt? Reply with quote

Hello,

I've made a template for documents that usually have only one page but sometimes more. If the documents have only one page, they mustn't have a page number. If they have more pages, they must have page numbers.

I use a different page style for page 1+n that has page numbers in the footer. Is it possible to configure my template that in case of multi-page documents a page number gets added to the first page as well?

Thanks for your help!



ltg73
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Tue Jun 06, 2006 6:03 am    Post subject: Reply with quote

Yes:

edit your template.

Add a second page (manually page break), apply your "2ndPage" style, edit as you like. Edit first page template to be followed by "2ndPage". Delete the page break, save template.

Everytime a document from that template need a second page your page style will be used.

Does this help?
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
ltg73
General User
General User


Joined: 04 Jun 2006
Posts: 32

PostPosted: Tue Jun 06, 2006 6:25 am    Post subject: Reply with quote

Winfried,

I already did what you wrote. My problem is this: When the document has more than one page, a page number should get added to the first page. Whereas the first (=single) page mustn't have a page number if the document has only one page. That the style for the second page always has page numbers is out of question.

Is this even possible to achieve with one template? I think I would need a third page style that gets used instead of the style for page one in case the document has multiple pages.



ltg73
Back to top
View user's profile Send private message
Westland
Super User
Super User


Joined: 03 Feb 2006
Posts: 562

PostPosted: Tue Jun 06, 2006 6:44 am    Post subject: Reply with quote

Check:
http://www.oooforum.org/forum/viewtopic.phtml?t=37117
_________________
"Do one thing every day that scares you"
Back to top
View user's profile Send private message
Captain Paralytic
General User
General User


Joined: 06 Jun 2006
Posts: 7

PostPosted: Tue Jun 06, 2006 7:00 am    Post subject: Reply with quote

That reference seems to give the same instructions as were given by probe1.

However this is not what the OP nor I need to do.

As posted in another thread (before I noticed this one), I currently use the following formula in Word to achieve the actual requirement which is to have the text "Page n of t" appearing on ALL pages INCLUDING the first page, but only when there are more than one pages in the document. So if there is only 1 page, then there will be NO page numbering and if there is more than one page, then the page numbering will start on the first page as "Page 1 of t".

Here is the formula that I use in Word:

{ IF { NUMPAGES \* MERGEFORMAT } > 1 "Page { PAGE /* MERGEFORMAT } of { NUMPAGES \* MERGEFORMAT }"
\* MERGEFORMAT }

Can anyone point to how to accomplish this in OO?
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Tue Jun 06, 2006 7:13 am    Post subject: Reply with quote

ltg73,

I see..... no solution "out of the box".

It should be possible to run a macro to count pages and apply an alternative (pre-prepared) style (with page no. in footer) if count > 1 (bound to "Document Close" event?)

Could you work it out in BASIC? Need help?
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
Captain Paralytic
General User
General User


Joined: 06 Jun 2006
Posts: 7

PostPosted: Tue Jun 06, 2006 7:36 am    Post subject: Reply with quote

One can check for multiple pages using a conditional text field. One can also use database fields in the Then and Else portions. What I cannot figure our how to do is to use document fields shuch as the page number and the total pages in the Then and Else portions.

Can anybody help with the correct syntax as I hav been unable to find it in the help.

TIA
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Tue Jun 06, 2006 8:43 am    Post subject: Reply with quote

for anyone who might need this, here is a quick solution in Basic. Dirty: see inline comments. Use at own risk.
Code:
' 20060606 oooforum 37637
' OOo 2.0.2 Linux
' writer macro w/o error checking
' cursor has to be in text
' (not within header/footer, frames, tables or such)
Sub writer_modify1stPageStyle

' get cursor
oCtrl = ThisComponent.CurrentController
oViewCursor = oCtrl.getViewCursor()

' only to end of range
oViewCursor.gotoEnd( FALSE ) 

if oViewCursor.Page > 1 then
'   msgbox "apply style to first page"
   ' goto start of document
   oViewCursor.gotoStart( FALSE ) 
   ' ### change name here ###
   ' apply page style
   oViewCursor.setPropertyValue "PageDescName", "Sonderseite"
'else
'   msgbox "nothing to do - only one page"
end if
End Sub


HTH
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
ltg73
General User
General User


Joined: 04 Jun 2006
Posts: 32

PostPosted: Tue Jun 06, 2006 8:54 am    Post subject: Reply with quote

Thank you VERY much, Winfried. I will check it tomorrow and report back tomorrow evening (German time).

On a side note: I just tried to apply different page styles to a document and couldn't do it. It was simply a page style to follow the default page style. OOo was crashing one time after another. I'm using the latest RC5. Unbelievable.
Back to top
View user's profile Send private message
ltg73
General User
General User


Joined: 04 Jun 2006
Posts: 32

PostPosted: Wed Jun 07, 2006 9:57 am    Post subject: Reply with quote

Winfried,

I didn't get this to work. I'm fairly new to OOo (1 week user). For the time being I'm leaving the template as it is now. For the rare cases (15%) where this document will have more than one page, we will insert the first page number manually.

Another thing I noticed is that in Germany (DIN 5008,14.18) it is still preferred to mark the first page in a multi-page document by "..." on the lower right corner. Every following page gets the page number in the form "- # -" centered below the letterhead and the "..." in the lower right corner, if there is a following page. This leaves the last page only with the page number but without the "...", which would make a makro even more complicated.

Thanks a lot,



ltg73
Back to top
View user's profile Send private message
probe1
Moderator
Moderator


Joined: 18 Aug 2004
Posts: 2560
Location: Chonburi Thailand Asia

PostPosted: Wed Jun 07, 2006 2:28 pm    Post subject: Reply with quote

ltg73 wrote:
I didn't get this to work. I'm fairly new to OOo (1 week user).


Let us know if we can help you on getting this thing run. Where's the problem(s)?


ltg73 wrote:
Another thing I noticed is that in Germany (DIN 5008,14.1Cool it is still preferred...


Well,
[working as a software quality manager]
papers I do control have last author, last edit date, path and filename and "Seite 1 von 3" on every page (exception: a "promotional" first page will have none of these, but present the project's name, logo and doc purpose ("Integration Test Concept", "Report 22/2006"). In my technical business it's essential to now those things.

The format "Page 1 of 3" is allowed instead of using the dots, see here; at end, so it's no problem for a template Smile

And if companies/employees don't have to (because of no government or international communication): I can tell you, they do want they want, exceptionally in internal documents.


Anyway: good luck with OOo.
(please add OOo and OS versions to next posts; subject of this was 1+)
_________________
Cheers
Winfried
My Macros
DateTime2 extension: insert date, time or timestamp, formatted to your needs
Back to top
View user's profile Send private message Visit poster's website
ltg73
General User
General User


Joined: 04 Jun 2006
Posts: 32

PostPosted: Thu Jun 08, 2006 7:33 am    Post subject: Reply with quote

Winfried,

I think conditional text fields are the neatest solution for this.

I have two page styles: Default for the first page and X for all following pages. Page style X shows the page number in the form "- # -" in the header. Additionally, both page styles have a conditional text field in the footer that shows "..." if the current page number is less than the page count.

In the conditional text fields windows are three boxes where I can enter something for CONDITION, THEN and ELSE.

CONDITION: current page number < page count
THEN: ...

I figured out the variable for the page count is "PAGE" but didn't find anything on the current page number. Can you help further? Thanks again!



ltg73


P.S.: I know I can also use "Seite 1 von 2" but that would have to be printed on the top of the first page as well and wouldn't look as aesthetic as the dots at the bottom.

And I'm a pedant.
Back to top
View user's profile Send private message
BillP
Super User
Super User


Joined: 07 Jan 2006
Posts: 2703

PostPosted: Thu Jun 08, 2006 8:28 am    Post subject: Reply with quote

ltg73 wrote:
In the conditional text fields windows are three boxes where I can enter something for CONDITION, THEN and ELSE.

CONDITION: current page number < page count
THEN: ...

I figured out the variable for the page count is "PAGE" but didn't find anything on the current page number. Can you help further? Thanks again!


The Help file states that internal variables, such as the page number cannot be used in condtition expressions.

I found this under variables;in conditions in the Help file Index.
Back to top
View user's profile Send private message
ltg73
General User
General User


Joined: 04 Jun 2006
Posts: 32

PostPosted: Thu Jun 08, 2006 8:43 am    Post subject: Reply with quote

[Edited for nonsense]

Yes, I found what you mean.
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 Writer 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