Hi Markus,

I have taken another look at the problem and found that the reason why it is 
not adding it as a child of the RtfListItem is because it's needs a table 
container. When the table FONode is processed, it tries to find the last 
container which implements the IRtfTableContainer interface 
(RTFHandler.java:530). As neither the RtfList or RtfListItem implements the 
IRtfTableContainer interface, the next one it finds is the main RtfSection 
which is the parent to the lists. This is why the table is added where it is.

I did try modifying the RtfListItem (attached) to become a table container and 
while it allowed it to be added as a child, the RTF output (also attached) 
doesn't seem to be right and is a bit hit and miss whether it will open in rtf 
viewers or not (WordPad works whereas OpenOffice doesn't). The next steps would 
be to compare some valid output for an example from Word with the output from 
FOP and see what the differences are. It may just be one or two tags in the 
wrong place in which case it would be a fairly easy fix. Another option may be 
to add a new table container as a child of the list item and do it that way.

This whole thing would be a temporary workaround however as there is definitely 
something not right with the current RTF implementation. For example, some 
child objects are stored as single variables meaning that you can't have more 
than one of something unless specifically handled. There are also lots of 
special cases if certain objects are children of others instead of using a more 
generic approach. I am not sure if this is down to the complexities of RTF or 
just the implementation, but it definitely deserves some attention in future.

I hope this points you in the right direction.

Regards,

Robert Meyer

Subject: AW: Help needed for RTF
Date: Thu, 21 Feb 2013 16:08:37 +0100
From: markus.sticker.e...@zf.com
To: fop-dev@xmlgraphics.apache.org

Hi Robert, Yes, I think there are just some small parts to change.Adding the 
table as child to the textrun of the RtfListItem. I already did the indent and 
the spacecalc for nasted tables.(that was a request by our internal users)Maybe 
you could be so kind and give me a hint for adding 
the table to the textrun. Thanks for your help and best regards Markus Von: 
Robert Meyer [mailto:rme...@hotmail.co.uk] 
Gesendet: Donnerstag, 21. Februar 2013 15:42
An: fop-dev@xmlgraphics.apache.org
Betreff: RE: Help needed for RTF Hi Markus,

I had a quick look at this yesterday but didn't get very far with it past 
confirming what you said earlier. The structure being written has the two list 
items containing only the textrun as children with the table being listed 
separately below. I am not sure yet whether it would simply be a case of fixing 
this by adding the table rtf element as a child of the listitem or whether 
there is more to it. 

I did notice that the table has a case to determine if the is table nested 
within a table cell and to perform a special case where it writes the "pard" 
keyword. According to the RTF specification, pard is used to reset the text 
formatting so that may need to be done as well for nested tables in lists. I am 
afraid I am not that familiar with RTF to know whether anything else needs to 
be done in this case, but it might just be worth trying it first and see what 
the result is.

If I get a bit of spare time i'll take another look and see if I can get it to 
correctly add the table as a child item and see what happens. In any case i'll 
let you know what I find.

Regards,

Robert MeyerSubject: Help needed for RTF
Date: Thu, 21 Feb 2013 14:19:09 +0100
From: markus.sticker.e...@zf.com
To: fop-dev@xmlgraphics.apache.orgHello, I’m looking for Tables nested in 
Lists.I need some information about the process that lead to
lists without  nested tables. Mit freundlichen Grüßen/Kind regardsMarkus Sticker
Technik ZF-Konzern/Operations and Technology ZF Group
Infrastruktur/Infrastructure (OTEP4)ZF Friedrichshafen AG
88038 Friedrichshafen, Deutschland/Germany
Telefon/Phone  +49 7541 77-7644, Telefax/Fax  +49 7541 77-907644
markus.sticker.e...@zf.com
Vorsitzender des Aufsichtsrats/Chairman of the Supervisory Board: Prof. Dr. 
Giorgio Behr 
Vorstand/Board of Management: Dr. Stefan Sommer (Vorsitzender/CEO), Dr. 
Konstantin Sauer, Dr. Peter Ottenbruch, Jürgen Holeksa, Dr. Gerhard Wagner, 
Reinhard Buhl, Rolf Lutz, Wilhelm RehmSitz/Headquarters: Friedrichshafen 
Handelsregistereintrag Amtsgericht Ulm HRB 630206/Trade register of the 
municipal court of Ulm HRB 630206 
                                          

Attachment: patch.diff
Description: Binary data

{\rtf1 \ansi {\colortbl; \red0\green0\blue0; \red255\green255\blue255; \red255\green0\blue0; \red0\green255\blue0; \red0\green0\blue255; \red0\green255\blue255; \red255\green0\blue255; \red255\green255\blue0; \red0\green0\blue128; \red0\green128\blue128; \red0\green128\blue0; \red128\green0\blue128; \red128\green0\blue0; \red128\green128\blue0; \red128\green128\blue128; \red192\green192\blue192; } {\fonttbl { \f0 Arial;}{ \f1 Symbol;}{ \f2 Times New Roman;}{ \f3 ZF Sans;}{ \f4 monospace;} } {\*\generator Apache XML Graphics RTF Library;} \fet0 \ftnbj {\*\listtable {\list\listtemplateid-723955400\listsimple{\listlevel\leveljc\levelfollow0\levelspace0\levelindent283{\leveltext\'02A.}{\levelnumbers}}{\listname ;}\listid-1155484576} {\list\listtemplateid-1690734402\listsimple{\listlevel\leveljc\levelfollow0\levelspace0\levelindent283{\leveltext\'02B.}{\levelnumbers}}{\listname ;}\listid1033096058} {\list\listtemplateid1327362106\listsimple{\listlevel\leveljc\levelfollow0\levelspace0\levelindent283\levelstartat1{\leveltext\'03\'00. ;}{\levelnumbers\'01;}\f0 }{\listname ;}\listid-1557280266} {\list\listtemplateid502539523\listsimple{\listlevel\leveljc\levelfollow0\levelspace0\levelindent283\levelstartat1{\leveltext\'03\'00. ;}{\levelnumbers\'01;}\f0 }{\listname ;}\listid-1930858313} {\list\listtemplateid-938301587\listsimple{\listlevel\leveljc\levelfollow0\levelspace0\levelindent283{\leveltext\'02C.}{\levelnumbers}}{\listname ;}\listid-1728529858} } {\*\listoverridetable {\*\listoverride{\listid-1155484576\listoverridecount0\ls1}} {\*\listoverride{\listid1033096058\listoverridecount0\ls2}} {\*\listoverride{\listid-1557280266\listoverridecount0\ls3}} {\*\listoverride{\listid-1930858313\listoverridecount0\ls4}} {\*\listoverride{\listid-1728529858\listoverridecount0\ls5}} } \paperw11905 \paperh16837 \margt1700 \margb1700 \margl850 \margr850 \headery1417 \footery1417 \itap0 \sectd {\li0 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } {\li0 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 Einfache \u220\'3fberschrift \par } } {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } }\pard \fi-360 \li {\*\pn \pnlvlblt \ilvl0 \ls1 \pnindent283 \pnf1 {\f2 \pntxtb A.}}\ls1 {\pntext } {\li763 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } {\li763 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 erster TOP Eintrag \par {\pntext } } } {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } }\pard \pard \fi-360 \li {\*\pn \pnlvlblt \ilvl0 \ls2 \pnindent283 \pnf1 {\f2 \pntxtb B.}}\ls2 {\pntext } {\li763 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } {\li763 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 Zweiter TOP Eintrag \par {\pntext } } } {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 }\pard \fi-360 \li {\*\pn \pnlvlbody \ilvl0 \ls0 \pndec \pnstart1 \pnindent \pntxta. }\ls3 {\pntext \f1 \'b7 \tab } {\li1526 \f4 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f4 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } {\li1526 \f4 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f4 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 B.2 Eintrag \par {\pntext \f1 \'b7 \tab } } } {\f4 \strike0 \ul0 \b0 \fs16 \cf1 \i0 }{ {\trowd \itap0 \trleft0 \clbrdrt \brdrw20 \brdrcf1 \brdrs \clbrdrb \brdrw10 \brdrcf1 \brdrs \clbrdrl \brdrw20 \brdrcf1 \brdrs \clbrdrr \brdrw20 \brdrcf1 \brdrs \trql \cellx5070 \clbrdrt \brdrw20 \brdrcf1 \brdrs \clbrdrb \brdrw10 \brdrcf1 \brdrs \clbrdrl \brdrw20 \brdrcf1 \brdrs \clbrdrr \brdrw20 \brdrcf1 \brdrs \trql \clvertalt \cellx7605 \clbrdrt \brdrw20 \brdrcf1 \brdrs \clbrdrb \brdrw10 \brdrcf1 \brdrs \clbrdrl \brdrw20 \brdrcf1 \brdrs \clbrdrr \brdrw20 \brdrcf1 \brdrs \trql \clvertalt \cellx10140 \intbl {\li1526 \f4 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f4 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 CELL 1 \cell } }\f4 \li1526 \strike0 \ul0 \b0 \qj \sa0 \sb0 \fs16 \ri0 \cf1 \i0 \intbl \intbl {\li1526 \f4 \b0 \ri0 \fs16 \cf1 \qc \i0 {\f4 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 CELL 2 \cell } }\f4 \li1526 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \ri0 \cf1 \i0 \qc \intbl \intbl {\li1526 \f4 \b0 \ri0 \fs16 \cf1 \qr \i0 {\f4 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 CELL 3 \cell } }\f4 \li1526 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \ri0 \cf1 \i0 \qr \intbl \row }}{\pntext \f1 \'b7 \tab } {\f4 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } }\pard \pard \fi-360 \li {\*\pn \pnlvlbody \ilvl0 \ls0 \pndec \pnstart1 \pnindent \pntxta. }\ls4 {\pntext \f1 \'b7 \tab } {\li1526 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } {\li1526 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 B.3 Eintrag \par {\pntext \f1 \'b7 \tab } } } {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } }\pard {\pntext } {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } }\pard \pard \fi-360 \li {\*\pn \pnlvlblt \ilvl0 \ls5 \pnindent283 \pnf1 {\f2 \pntxtb C.}}\ls5 {\pntext } {\li763 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } {\li763 \f3 \qj \b0 \ri0 \fs16 \cf1 \i0 {\f3 \strike0 \ul0 \b0 \sa0 \sb0 \fs16 \cf1 \i0 Dritter Top Eintrag \par {\pntext } } } {\f3 \strike0 \ul0 \b0 \fs16 \cf1 \i0 } }\pard }

Reply via email to