March 7, 2008
Adding Page Numbers to Google Documents
Google finally realized that the headers and footers from Google Docs have almost no real use, as you can't add dynamic information like page numbers or the current date. Until Google adds these options in the interface, you can edit the document's HTML code to use them. To add a header that displays "Page (current page number) of (total number of pages)" , click on "Edit HTML" and add this code at the beginning of the document:
<div style="text-align: right;" class="google_header">Page <span class="google_pagenumber">1</span> of <span class="google_pagecount">1</span></div>
When you save the document as a PDF, the header will look like this:
For footers, you should add this at the bottom of the document, in HTML view:
<div style="text-align: right;" class="google_footer" id="google_footer">Page <span class="google_pagenumber">1</span> of <span class="google_pagecount">1</span></div>
It's a good idea to go back to the rich text editor quickly if you don't want to see the horrible code generated by Google Docs. The "dynamic" headers and footers are visible only if you export the document to PDF, for example to print it.
<div style="text-align: right;" class="google_header">Page <span class="google_pagenumber">1</span> of <span class="google_pagecount">1</span></div>
When you save the document as a PDF, the header will look like this:
For footers, you should add this at the bottom of the document, in HTML view:
<div style="text-align: right;" class="google_footer" id="google_footer">Page <span class="google_pagenumber">1</span> of <span class="google_pagecount">1</span></div>
It's a good idea to go back to the rich text editor quickly if you don't want to see the horrible code generated by Google Docs. The "dynamic" headers and footers are visible only if you export the document to PDF, for example to print it.
Subscribe to:
Post Comments (Atom)
22 comments:
Actually, it is possible to use GDocs to do the page number deal. It's just combining the header with the document and print settings.
Reply DeleteExample Doc. Ignore the actual content of the document. As you can see, it's an APA-style paper, complete with a header.
All you have to do is set the default document font in the doc settings to the font and size you use in that header.
Make a header that's, for instance, a two-word abbrev. title with five spaces.
THEN, select "Top Right" from the page numbers selection list in the print menu.
It should all line up and work just like MSWord, just a little more complex -- but WITHOUT any html to scare away novices.
If you export a PDF you can choose if there should be Pages nummbers
Reply DeleteYes, I knew that, but you don't have any formatting options. Your method only shows the number of the current page, but you can't display:
Reply Delete-4-
(4)
Page 4 of 10
you can't change the color, the font etc.
You're right -- your technique is pretty boss.
Reply DeletePagination - now THERE's a feature GDocs badly needs...
Reply DeleteWhy does the footer HTML have the div 'id' and 'class', but the header HTML hasn't got the 'id'? And also, why does it have to be exported as a PDF? Surely it would be more useful if that wasn't necessary?
Reply Deleteanother good use of google's 'edit html' is for inserting greek characters (or any other characters not present in the 'insert special character' menu...). it's pretty useful when co-editing a scientific paper, and i'm sure there are plenty more applications.
Reply Deletesimply find the html code for the symbol of interest here. then just throw that into the html version of the google doc.
its much quicker/easier than the advanced insertion of unicode letters, which you have to browse one by one...i found that some unicode strings didnt even work for some greek letters.
Take care: when you export to rtf or odf the pagenumber footer is * converted * to static text at the end of the document (useless)
Reply DeleteGenerated PDF doesnt contain page numbers. The last page just shows Page 1 of x! Major Fail!
Reply DeleteYes, this feature is really needed. Thanks for the workaround anyways.
Reply DeleteAnything that makes google docs work better is all right with me!
Reply DeleteImplemented but not exposed, eh? Thanks for the tip!
Reply DeleteThese are the many small things that GDocs still needs to simplify for the masses to use. It is just too hard otherwise, for a kid and/or novice to do this.
Reply DeleteThank you so much! One of my teachers insists on using page numbers, and I would have resorted to handwriting them. I was concerned I wouldn't be able to edit the header from the "Page 1 of X" format, but was thankful to find that not the case! As someone completely foreign to html, I didn't find it too hard. Like he said, just copy paste.
Reply DeleteBrad, I can't get your method to work. The Header won't line up with the page number.
Reply DeleteWorked great for me, and all just a Google search away. Nice!
Reply DeleteCheers matey.
This was PERFECT. Thanks. Exactly what I was googling for.
Reply Deleteits works for me easy trick
Reply DeleteI just copy paste to word and then insert the page #
Reply DeleteGDocs is ok for what it is, but if Google is planning on moving the masses to GDocs then they have a lot of catching up to do. I would like to see a citation section for APA 6, MLA and the other popular citation formats. Pagination is still WAY to cumbersome and clunky. You're almost better off sticking with MS Works until GDocs catches up...which they will in time.
Reply Deletegrrr... google docs has no table cell merging and no page numbers. oh, and there is no way to remove a header or footer once you've inserted it - all you can do is delete the contents, but the extra line is still there. the solution is always "edit the html". lame. so so sooooo lame. google docs is fine for really simple things like task lists, but for formal things that require more advanced formatting like resumes it's completely WORTHLESS.
Reply Deleteyou could also just go to insert and then click page number
Reply DeleteNote: Only a member of this blog may post a comment.
[フレーム]