Page 1 of 1

[Solved] Telling ODT documents to not break tables at pagebr

Posted: Thu Oct 07, 2010 9:01 am
by b1rules
Hi Folks,
the task is simple, generate a new ODT File where new added tables DO NOT break around pages.

It is easy to tell a table to not break around pages in her properties - but I found NO solution to get it as a preset.

The Usecase is a wiki plugin which generates template based ODT Files and uses one ODT File as Template. In this Template I can define all sorts of styles and use themn with the wiki converter. That works fine, but I found no way to define the "non breaking" as a style Sad(

I already posted to the Writer Forum:
http://api.openoffice.org/docs/common/r ... Table.html

This was my text there:
Hi Folks,

this is my first post - I love OOo, I never had a question I couldn't google or help myself.

This time it's different.

I habe an ODT File which is used in a webapp as a template.
Basicaly I define Styles in the document and habe 2 kind of marks:
- INSERT START & STOP Marks to tell the webapp where to put in the content
- NOT PRINT START & STOP Marks to tell the webapp that this stuff is not for the output, here i put my styles in.

My simple Problem:
How can I tell the ODT file to NOT break tables at the borders of pages?
I can do this for each table individually, but my webapp is creating tables on its own.
It there a way, maybe via styles or global preference, to tell the document to NOT break any tables?

I would be happy if someone of you knew a solution,

best Greetings from Germany,

Chris

PS: this is the exact usecase: http://www.dokuwiki.org/plugin:odt

Re: Telling ODT documents to not break tables at page border

Posted: Thu Oct 07, 2010 4:44 pm
by acknak
Do you have access to the document xml?

OOo Writer does not support table styles, but ODF does. Here's the xml generated by Writer with a non-breaking table:
  • <office:automatic-styles>
      <style:style style:name="Table1" style:family="table">
        <style:table-properties
          style:width="6.925in" table:align="margins"
          style:may-break-between-rows="false"/>
      </style:style>
      <style:style style:name="Table1.A" style:family="table-column">... </style:style>
      <style:style style:name="Table1.A1" style:family="table-cell">... </style:style>
      ...
    </office:automatic-styles>

Re: Telling ODT documents to not break tables at page border

Posted: Mon Oct 11, 2010 9:11 am
by b1rules
Hi acknak,

thank you for this information - I have something inside the template folder called "styles.xml" the comment in the file says:

<!--
This file defines how the document is styled. This was extracted from a ODT file
created in OpenOffice 2.0 and could probably be much simpler.

You probably want to replace this file with a style fitting your corporate identity.

To do so, export the wiki:syntax page, edit it's style definitions (be sure to keep
the names) and save the resulting file. Extract the resulting file with unzip and
copy the styles.xml over this one.
-->

So I tried your red marked snipped there - but unfortunalty without success :(

I attached the file, maybee you got an Idea how to get your snipped inside - would be great.

regards, Christian

Re: Telling ODT documents to not break tables at page border

Posted: Mon Oct 11, 2010 9:24 am
by b1rules
It's me again - I feel the solution is near :)

I attached a second file - renderer.php

This seems to be the place where the odt file is put together.
I deeply feel that your codemodifications, nacknak, have to get inside this file somewhere.
I messed a bit araound, but w/o any success yet - maybee you could look at the file and tell me where to insert the one propertie you mentioned?

regards, Christian

Re: Telling ODT documents to not break tables at page border

Posted: Mon Oct 11, 2010 3:29 pm
by acknak
The xml snip I showed came from the content.xml part of the .odt file, near the top, before the actual body content.

I have no way of testing this, so no guarantee, but you can give this one a try--it should provide the no-break property for any table in the document.

Re: Telling ODT documents to not break tables at page border

Posted: Tue Oct 12, 2010 9:29 am
by b1rules
acknak wrote:The xml snip I showed came from the content.xml part of the .odt file, near the top, before the actual body content.

I have no way of testing this, so no guarantee, but you can give this one a try--it should provide the no-break property for any table in the document.
Thank you soooo much - this was brilliant :D

Works like a charme


Image


best regards,

Christian

Re: Telling ODT documents to not break tables at page border

Posted: Tue Oct 12, 2010 9:35 am
by b1rules
btw: I linked this thread to the dokuwiki ODT Plugins page here: http://www.dokuwiki.org/plugin:odt?&#general_use