I've gotten this question several times, and though it's a specialized question and a bit of a cluge answer, I think it's a good idea to post.
How do you automatically center text vertically on a page? For instance, if you have a title page and you want the title text centered vertically, how do you do that?
You don't do it with regular text; I haven't found a way to do that, at least. But you can do it with a text box.
Update March 11th: After much reading and discussion with Ross, Peter, Aspuldo, and others, I have finally zeroed in on the key thing about how to do this with frames. Phew!
Using a Frame
As Ross points out, this is approach survives changing the page size, orientation, or margins.
1. Open a new text document, or go to the page in your document where you want a vertically centered page.
2. Choose Insert > Frame.
3. Set the circled options in the Type tab. Key is, at the top, just make the frame about a line of text high; make the text autosize vertically; anchor to page (I hear you don't have to but that's how it works for me) and at the bottom, align the frame vertically at the center.
4. If you want, go to the Border tab and take off the border. You can also do this later once you've inserted the frame.
5. Click OK.
6. You get something like this.
7. Now just type, and the centering will happen.
Using a Text Box
This isn't as good a way, but it's a way.
1. Open a new text document, or go to the page in your document where you want a vertically centered page.
2. If the to-be-centered text is already on that page, like “John's Thesis on Eye Boogers,” select it and press Ctrl X to cut out the text. You'll have it ready to paste in later. (Or just delete it if you don't care about pasting.)
3. Choose View > Toolbars > Drawing. The Drawing toolbar will appear at the bottom of the work area, most likely. For this and all other icons in this post, click on the illustration to get a larger popup window.
4. Click the Text icon, far right in this illustration.
5. Draw a text box as big as the page.
6. Then immediately paste (Ctrl + V) your text that you cut out previously, if you did that, or just type the text that you want centered vertically. (If you don't type something in the text box, it'll disappear.)
7. Right-click on the text box border and choose Text. It should look like this, with green borders.
8. In the Text window, look for the Text Anchor section. Choose a centered point for the text box, as shown. Click OK.
Now the text is centered vertically within the text box.
9. Because you likely want this too, click the Center icon on the Formatting toolbar to center the text horizontally, too.
10. Make the text bigger and format it the way you want.
11. The page should look something like this.
"John's Thesis on Eye Boogers"
Can I pre-order it on Amazon?
Posted by: Roy Jacobsen | December 19, 2005 at 10:27 AM
Very Cool! Please don't forget to include an article on page numbers starting from second page as you promised :) [eventhough I think OpenOffice.org should do the whole page numbering with a friendlier way (see MSWord)]
Posted by: Nikos Kouremenos | December 19, 2005 at 03:19 PM
The easiest way to do it is with a frame that you can 'anchor' to the center of the page.
Insert -> Frame
Anchor -> To the page
Position -> Vertical (centered to Text Area)
Position -> Horizontal (centered to Text Area)
This way you do not need to draw the text field as big as the page.
Great blog, by the way.
Posted by: aspulido | December 20, 2005 at 03:56 AM
See precise instructions to do this on my blog:
http://openofficeorg.blogspot.com/2005/12/ttulos-en-portada-en-ooo-writer.html
Posted by: aspulido | December 20, 2005 at 04:41 AM
Hi Nikos,
>> "Please don't forget to include an article on page numbers starting from second page as you promised :)"
You know, I did, but looking back I named it too vaguely/generally. I have renamed it and rewritten it a tad. Here's the link:
http://openoffice.blogs.com/openoffice/2005/12/different_page_.html
Thanks for the comment and link!
~ Solveig
Posted by: Solveig | December 20, 2005 at 10:16 AM
Hi Roy,
>> "John's Thesis on Eye Boogers"
>> Can I pre-order it on Amazon?
Oh, you wouldn't believe the requests I've gotten! Both "John's Thesis on Eye-Boogers" and my 1200-page book on 19th Century Serbo-Croation feminist welders will be available in leatherbound collector's editions early in 2006. ;>
~ Solveig
Posted by: Solveig | December 20, 2005 at 10:25 AM
Hammers cracking nuts come to mind:-)
I remain to be convinced that a single-celled table isn't the simplest way to achieve page centring of text.
Peter HB
Posted by: Peter Hillier-Brook | March 10, 2006 at 09:47 AM
Hi Peter,
"I remain to be convinced that a single-celled table isn't the simplest way to achieve page centring of text."
It might be! ;> I'm just listing ways to do it.
Solveig
Posted by: Solveig | March 10, 2006 at 10:28 AM
Hi Solveig,
I didn't intend criticism of your suggestion. I just tend to follow Occam and prefer the simplest solution to a problem:-)
Peter HB
Posted by: Peter Hillier-Brook | March 10, 2006 at 04:27 PM
Did you notice that, with both the draw frame and the table, you had to size one or both dimensions? I.e. the table needed vertical height set; the draw frame needed both vertical and horizontal. Now what happens when the document page format is changed? E.g. from portrait to landscape, or from A4 to Letter?
Frames will do everything that you want to do for this task and more. The only external device you need to use is a page break or two when you want the frame to appear by itself on a page. That is the 'correct' method to use here rather than size the frame to exclude all else from the page.
There is a step missing in your procedure. Just before you centre align the text horizontally, you need to re-enter text edit mode in the draw frame, e.g. by double clicking it.
Comparing apples with apples:
For a single table cell used in this way to be rebust, you also need to set the table attributes so that table rows cannot be split across page or column boundaries. This is an extra set of clicks that should be counted in a fair comparison. Setting this attribute is also easily overlooked and not easy to remember.
Another problem with tables is that you can't anchor them to a specific page and have text flow around them, unless you put them into a frame. So you have a trick that works for this case but not for other, slightly different, cases.
I hadn't thought of using a drawing frame, however, my first preference is to always use the trick that is most consistent with the tool's working model, or rather, the model that the tool is attempting to have users work with. Because then you gain maximum benefit of the accumulated past experience of the designers and users of the tool. When new features are added or improved, it is usually done with the tool's model in mind.
I've seen people using all sorts of weird tricks in other applications, that probably will not survive future upgrades, or conversion to/from other formats.
Posted by: Ross Johnson | March 10, 2006 at 06:02 PM
Hi Ross,
I've worked with the frame approach and it doesn't seem to work. That's why I don't include that procedure.
I choose Insert > Frame. In the Type tab I anchor it to the page, and use the settings at the bottom to center the frame horizontally and vertically. The result is a nicely centered frame with top-aligned text within it.
If I'm missing a step in making the text center itself within a frame, and then the frame also within the page, please let me know.
Solveig
Posted by: Solveig | March 10, 2006 at 06:24 PM
I've been thinking about this, and I really believe it should be the ONLY procedure, for reasons explained earlier. Frames are a corner-stone device and learnt properly and well I'm convinced will release users creativity and effectiveness with OOo far more than any other bag of task-specific tricks.
Now, to the task at hand (with examples at the end):
If you see top-aligned text then you are still thinking that you need to size the frame vertically (perhaps in order to exclude other text from the page - I don't know). Forget that entirely - you want the frame to shrink/expand to fit the text automatically, both horizontally and vertically. So choose 'automatic' width and 'autosize' height. If the frame is autosizing vertically, then there is no such thing as top-aligned, centred, or bottom-aligned is there? :)
You may want to centre align the paragraph or not but that's not really important here. I.e. a left or right aligned paragraph can still be centred on the page can't it? Actually, this is another advantage of frames over the draw technique. With the draw method, you are compelled to have centre aligned text. (You see what you are missing now? Someone has thought of this already :)
If you want the text in the frame to be the only text on the page, precede the frame with a page break, and add another one after. The frame should be anchored to the paragraph between the breaks so that it will move relative within the document.
Don't anchor the frame to the page, unless you want it that way (see example 2 below), but then you should use the Wrap options and spacing to exclude other text etc from that page. Wrap before/after spacing can total a little over 43 cm, so 21cm before and after will effectively exclude everything from the page. Before and after spacing does not extend beyond the logical page, so this way you can still change the page format and not have to adjust frame size attributes to fix everything afterwards.
You may find that setting the Wrap option and before/after spacing works just as well as page breaks. I don't know - I'll try it - it's an option I suppose.
Example 1:
I want 'Hello world' centred H and V on the page, so that 'Hellow world' is the only text on that page. I want that page to be relative to the other content of the document, i.e. to move if I add or delete enough content ahead of this page.
1 - type Ctrl+Enter twice to insert two page breaks.
2 - position text cursor on paragraph between the page breaks.
3 - Insert - Frame
4 - in the Frame properties, set 'Centre' for both H and V, and relative to 'Page text' for both.
5 - choose 'Automatic' for H size and 'Autosize' for V size.
6 - anchor the frame to Paragraph (the default).
7 - set other attributes like borders etc.
8 - add text to the frame, and centre align the paragraph if you like.
Now, if you add sufficient new content before the page containing the frame, the frame will automatically jump to the next page.
Example 2:
I want the same text etc but this time I want the frame to stay on a specific page and the rest of the document to flow past it.
1 - position the text cursor in the page.
2 - use steps 3, 4 and 5 above to create the frame.
3 - anchor the frame to Page.
4 - set Wrap to 'None' and set the before and after spacing to 21.5cm (almost the maximum possible).
5 - do steps 7 and 8 as above to finish.
Now if you add sufficient new content before the page containing the frame, it will flow past the frame page.
Posted by: Ross Johnson | March 11, 2006 at 05:45 AM
Aha!
Ross, thank you so much for the detail on the frames.
Aha!
I was missing the concept of just starting with a single-line-height text frame.
Have updated the post.
Solveig
Posted by: Solveig | March 11, 2006 at 08:46 AM
I needed to centre text vertically and this solved it. The textbox thing, as you said is best avoided! Does anybody know if this is compatible with Word (i dont use that anymore)? I tried to open it in wordpad and it didn't show anything even though there was text in the file.
Posted by: The Bobla | May 08, 2006 at 05:53 PM
Hey! finally :) thanks for the tip.
All that said, I still wonder why there isn't a vertical align dropdown in the page format tab. Should be right there with margins and size. Say, I'm writing a poems book and want all 200 pages (that's a stretch, I know) centered both horizontally and vertically.
¿I'd have to make a frame for each page?
O.ó
not that I'm writing poems or anything.
I'm just saying.
Posted by: Madster | November 07, 2006 at 06:58 PM
I followed the exact steps above in OpenOffice Writer 2.0.4 (new document, insert->Frame, set to autosize, vertical center, no borders, OK). Then at step 7, when I "just type" it beeps at me instead. No error message, no helpful hint, nothing. Any idea? thx.
Posted by: Nemo Inis | November 08, 2006 at 02:57 PM
Or how about a business letter that should always be vertically centered?
Thanks for the info, this explains why I can't reproduce the beautiful results of TeX (easily) and why my MSWord imports look horrible.
I'm using oo.org 1.1.5, hopefully it will get vertical page centering in a newer version if it is not implemented already.
Posted by: Brandon | January 16, 2007 at 05:42 PM
Brandon, you aren't expecting OpenOffice.org to be as powerful as TeX, are you? ;>
I do hope that vertical alignment shows up as a checkbox soon.
Solveig
Posted by: Solveig Haugland | January 17, 2007 at 07:00 AM
Hi Nemo,
My apologies for the rather dramatic delay in responding. Frames ar a little twitchy. Click in a regular-text or blank part of the doc outside the frame, then click again in the frame, close to the border.
Solveig
Posted by: Solveig Haugland | January 17, 2007 at 07:02 AM
helo can anyone help me how to write a horizental wriiting, write with deep pressure, and leave space at the end of the page (vertically please explain me with picture or text thnks a lot
regarts from
zia khhot
vertically)
Posted by: zia khhot | November 19, 2008 at 08:09 AM
Thanks for the original post
4 years later and still useful!
Posted by: Jim | November 17, 2009 at 01:32 PM