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

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
b1rules
Posts: 5
Joined: Thu Oct 07, 2010 8:55 am

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

Post 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
Last edited by b1rules on Tue Oct 12, 2010 9:38 am, edited 1 time in total.
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

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

Post 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>
AOO4/LO5 • Linux • Fedora 23
b1rules
Posts: 5
Joined: Thu Oct 07, 2010 8:55 am

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

Post 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
Attachments
styles.xml.txt.zip
it is a TXT file not zip - the uploader won't let me upload xml oder txt, so i saved it as .zip
(16.77 KiB) Downloaded 561 times
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
b1rules
Posts: 5
Joined: Thu Oct 07, 2010 8:55 am

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

Post 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
Attachments
renderer.php.txt.zip
It is NOT a ZIP File, it's a txt file containing PHP source
(51.6 KiB) Downloaded 460 times
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

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

Post 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.
Attachments
renderer_acknak.php.txt.zip
(51.81 KiB) Downloaded 410 times
AOO4/LO5 • Linux • Fedora 23
b1rules
Posts: 5
Joined: Thu Oct 07, 2010 8:55 am

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

Post 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
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
b1rules
Posts: 5
Joined: Thu Oct 07, 2010 8:55 am

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

Post by b1rules »

btw: I linked this thread to the dokuwiki ODT Plugins page here: http://www.dokuwiki.org/plugin:odt?&#general_use
OpenOffice 3.1 on Windows Vista / NeoOffice 2.2.3 with MacOS 10.4 / OpenOffice 2.4 on Ubuntu 9.04
Post Reply