Pagination is broken in one document, need to CHANGE template

I have a document that’s based on a template which has two page styles (or is supposed to be). I have tried removing all the page styles saving and manually re-creating them. It always opens with a single page style, “Convert 1”. And when I remove the page styles, save, then create new page styles (two of them), then add a manual break and assign “Page 2” to the second page (formatted for tablet). Then I close and reopen, it has 9, or 13 pages with the Convert 1 style (which I had deleted). My defined page styles are gone. Then I repeat the process of deleting, re-creating page styles and using a manual break, and ensuring that there are only two pages. When I save and reload the document it has even more pages (as short as 7 inches)!

My pages are long (formatted for tablet), but I have created hundreds (maybe thousands) of docs with just two long pages using a few templates I’ve created. This one is the only troublemaker.

Document | Properties shows that it’s based on an old template using a MS word “.dot” file. How I’d love to change that! That would probably solve my problem. I can Load Styles, and have done many times, but it doesn’t fix this issue.

Save your documents to ODT.

Uuuugh- I was SURE it was. It wasn’t, so I did that.

You solved my problem. Going to slink off to a dark corner now!

THANKS!

Changing templates is not easy in LO Writer. No UI is available for that. There are a few extensions but I haven’t tested them. You may try a hack but it is not 100% guaranteed.

  1. Save your document File>Save as with extension .fodt (called “flat XML”)

  2. Open the .fodt file with a text editor (gedit or KWrite in Linux, TextEdit in MacOS, NotePad in Windows)

    CAUTION! .fodt format is not intended to be human-edited or -read and lines may be very very very long, beyond the capacity of the text editor internal buffer. There is an option to avoid this, but I don’t remember it. In my experience, this happens only in really big documents.

  3. With the Find tool, search for <meta:template

  4. Patch this XML element:

    • xlink:title= is the name used in File>Properties, better keep it in sync with the file name (without extension)
  • xlink:href= is the file path to the template

    CAUTION! It is a relative path starting from the document location; it may be tricky to get it right.

  • meta:date= is a reference date for the template lastly used by the document (see below)

  1. Save the patched .fodt
  2. Open the patched .fodt with LO Writer

The template designation is in title= and href=. However, LO Writer won’t update styles if it thinks the template has not changed: for that, it compares the template modification date (retrieved from the file system) to the date in date=. If template date is newer than reference date, styles are updated. Thus, in principle, no need to fiddle with date=.

BUT, I met difficulties if date= is really too old where Writer did not take into account the modified template. Apparently, date= should not be older than two months for automatic update.

Don’t hesitate to come back if it does not work. BTW, what is your OS? LibO version?

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Changing templates is not easy in LO Writer. No UI is available for that.

Well, quite easy with TemplateChanger. See:

@gabix: I am aware of this extension but some questions/answers reported incompatibility with recent LO versions. I’ve not tested it and I wonder if it’s able to cope with the date “glitch” I experienced.

Works for me in LO 6.0.4/6.0.5 under MS Windows and openSUSE Linux. Not sure about the glitch you’ve mentioned, though.

@gabix: thanks for the update info