View Single Post
Old 10-23-2006, 02:54 AM   #1
AnsgarSerif
Member
AnsgarSerif began at the beginning.
 
Posts: 16
Karma: 10
Join Date: Oct 2006
Device: Sony PRS-500
Formatting Gutenberg txt Files

This may or may not fit here, but I've been working on macros in OpenOffice.org and Microsoft Office to convert .txt files on Gutenberg to something more readable and "bookmarkable."

Since I'm new at macros and hate programming, I had to use both MS Word and OpenOffice. MS Word is able to insert page breaks at chapter and book headings (which OpenOffice can't, apparently) and doesn't randomly erase swaths of text when running the "End-of-line Remover" macro (which OpenOffice does consistently). The documentation (if I may be allowed to disgrace the name) is therefore somewhat complex but I'm hoping that can be fixed - and I think the end result is well worth the effort.

I have it streamlined to five macros. After about 10-20 minutes of fine-tuning, I can have a fully bookmarked, formatted and stylized book ready to read comfortably.

I looked around the forums but haven't found anything like what I can make from txt files, so I'd like to post up the macros, the template and the exported PDF I use for the Sony Reader. I imagine that people who know more about the programming side of macros could streamline this a lot better - or get things working completely in OpenOffice.org, at least.

If this interests anybody, take it and run with it (or start from scratch and do something much better). Note that the page format for the Sony Reader is 3.57"x4.82 - I don't have mine yet and I picked up these dimensions from somewhere in the past.

Thanks everyone,

Sam

EDIT: New Version 0.3.3

There was a bug in 0.3 that prevented applying the text body style to the entire project before applying heading styles, which made the text font and size inconsistent. Should be fixed now. I know, I know - absolutely no quality control on my part.

Here we go,

Major changes:
  • One macro to convert text (as opposed to five)
  • Everything (including page breaks) runs in OpenOffice.org
  • User prompt for Author, Title
  • Author, Title inserted in page headers
  • Separate macros for saving to RTF and PDF

Changes from 0.3
  • Primary text changed to Garamond 13
  • Primary text consistency bug fixed
  • Fixed infinite loop bug

Changes from 0.3.2
  • Page size changed to 5.24" x 6.69", since more people seemed to prefer that on the forums
  • Chapter Headings 2 and 3 no longer have a page break inserted before them (Sorry about that)

It's a bit on the slow side - about three minutes for a 600 page book (formatted for the Sony Reader's screen size) and about ten minutes for an 1800 page book.

Anybody got any good ideas I could add to this?

Sam

Last edited by AnsgarSerif; 10-31-2006 at 02:45 PM. Reason: New version - 0.3.3
AnsgarSerif is offline   Reply With Quote