Zum Inhalt springen

Absatzformatierung in Tabellen

Erstellt am 12. August 2008 · 1 Antwort · letzte Antwort am 23. August 2008

Tags: Frage

Niklas Lazinbee ·

Hallo,
vielleicht hat ja jemand einen Tip für mich, da ich schon tagelang an dem Problem forsche und keine Lösung finde.

Vorweg geschickt, ich benutze tinyRTE, ich glaube aber das macht keinen Unterschied.

Wenn ich nichts weiter einstelle sehen meine Tabellen in HTML so aus:

<p class="bodytext">1. Zeile </p>
<p class="bodytext">& nbsp;</p>
<p class="bodytext">2. Zeile</p>
<table style="height: 211px;" border="1" width="390" class="contenttable">
  <tbody>
    <tr>
      <td><p class="bodytext">1. Zeile</p>
        <p></p>
        <p>2.Zeile</p></td>
    </tr>
  </tbody>
</table>

Mein Ziel ist nun, auch in der Tabelle in der Leerzeile (Nr.8,<p></p>) ein & nbsp; einzufügen und den Ps eine class zuzuteilen. Nach langem Suchen bin ich auf folgende Lösung gekommen:

lib.parseFunc_RTE < lib.parseFunc

lib.parseFunc_RTE {
	externalBlocks = table,blockquote,ol,ul,p,div
	externalBlocks {
		
		blockquote.stripNL=1
		blockquote.callRecursive=1
		blockquote.callRecursive.tagStdWrap.HTMLparser = 1
		blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs = style="margin-bottom:0;margin-top:0;"

		ol.stripNL=1
		ol.stdWrap.parseFunc = < lib.parseFunc

		ul.stripNL=1
		ul.stdWrap.parseFunc = < lib.parseFunc
 

		table.stripNL=1
		table.stdWrap.HTMLparser = 1
		table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
		default = contenttable
		always = 1
		list = contenttable
		}
		
		table.stdWrap.HTMLparser.keepNonMatchedTags = 0
		table.stdWrap.HTMLparser.allowTags = table,tr,td,div,p
		table.HTMLtableCells=1
		table.HTMLtableCells {
			addChr10BetweenParagraphs=0
			default.callRecursive=1	
			}
			
		p.stripNL=1
		p.stdWrap.HTMLparser = 1
		p.stdWrap.HTMLparser.tags.p.fixAttrib.class {
		default = xxx
		always = 1
		list = xxx
		}
			
		p.stdWrap.encapsLines {
  			encapsTagList = p,div
  			innerStdWrap_all.ifEmpty = & nbsp; 
    			}
	
		} 	
}

Das Ergebnis ist dann:

1. Zeile

2. Zeile
<table style="height: 211px;" border="1" width="390" class="contenttable">
  <tr>
    <td><p class="xxx">1. Zeile</p>
      <p class="xxx">& nbsp;</p>
      <p class="xxx">2.Zeile</p></td>
  </tr>
</table>

Eigentlich das was ich will, nur das nun die Formatierung außerhalb der Tabelle weg ist, wofür die Zeile 1 im TS verantwortlich ist (lib.parseFunc_RTE < lib.parseFunc), lasse ich die aber weg, wird innerhalb der Tabelle alles ziemlich gedoppelt, das sieht dann so aus:

<p class="bodytext">1. Zeile </p>
<p class="bodytext">& nbsp;</p>
<p class="bodytext">2. Zeile</p>
<table style="height: 211px;" border="1" width="390" class="contenttable">
  <tr>
    <td><p class="bodytext">& nbsp;</p>
      <p class="xxx">1. Zeile</p>
      <p class="bodytext">& nbsp;</p>
      <p class="xxx">& nbsp;</p>
      <p class="bodytext">& nbsp;</p>
      <p class="xxx">2.Zeile</p>
      <p class="bodytext">& nbsp;</p></td>
  </tr>
</table>

Falls irgendjemand etwas dazu einfällt, wäre ich total dankbar.

Beste Grüße
Niklas

Niklas Lazinbee ·

Für das Problem habe ich letztendlich folgende Lösung gefunden, die anscheinend funktioniert, ohne dass ich es beschwören will:

lib.parseFunc_RTE {
	externalBlocks = table,blockquote,ol,ul,p
	externalBlocks {
		
		blockquote.stripNL=1
		blockquote.callRecursive=1
		blockquote.callRecursive.tagStdWrap.HTMLparser = 1
		blockquote.callRecursive.tagStdWrap.HTMLparser.tags.blockquote.overrideAttribs = style=”margin-bottom:0;margin-top:0;”

		ol.stripNL=1
		ol.stdWrap.parseFunc = < lib.parseFunc

		ul.stripNL=1
		ul.stdWrap.parseFunc = < lib.parseFunc
		


		table.stripNL=1
		table.stdWrap.HTMLparser = 1
		table.stdWrap.HTMLparser.tags.table.fixAttrib.class {
			default = contenttable
			always = 1
			list = contenttable
		}
		
		table.stdWrap.HTMLparser.keepNonMatchedTags = 1
		table.HTMLtableCells=1
		table.HTMLtableCells {
			addChr10BetweenParagraphs = 1
			default.callRecursive = 0
			default.stdWrap.parseFunc = < lib.parseFunc_RTE
			default.stdWrap.parseFunc.nonTypoTagStdWrap.encapsLines {
				encapsTagList = div,p,pre,h1,h2,h3,h4,h5,h6
				remapTag.DIV = P
				nonWrappedTag = 
				innerStdWrap_all.ifBlank = 
				addAttributes.P.class = bodytexttabelle
				addAttributes.P.class.setOnly=blank
			}
		}
		

		p.stripNL=1
		p.stdWrap.parseFunc = < lib.parseFunc
		p.stdWrap.HTMLparser = 1
		
		p.stdWrap.encapsLines {
  			encapsTagList = p,div
   			remapTag.DIV = P
  			innerStdWrap_all.ifEmpty = &nbsp;
  			addAttributes.P.style = margin:0px
  			addAttributes.P.style.setOnly=blank
    		}
		

	} 

}

Falls jemand Fragen oder Anregungen dazu hat, bitte melden.

Gruß Niklas