---
title: "Absatzformatierung in Tabellen"
url: "https://www.typo3.net/d/80598-absatzformatierung-in-tabellen"
source: "typo3.net"
tags: ["TYPO3","TypoScript","Frage"]
created: "2008-08-12"
last_reply: "2008-08-23"
replies: 1
solved: false
page: 1
pages: 1
lang: "de"
---

# Absatzformatierung in Tabellen

TYPO3 › TypoScript · 1 Antwort · gestartet 2008-08-12

## Eröffnungsbeitrag

**Niklas Lazinbee** · 2008-08-12 · [Beitrag #1](https://www.typo3.net/d/80598-absatzformatierung-in-tabellen/1)

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:

```html
<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:

```typoscript
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:

```html
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:

```html
<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

## Antworten

### [#2](https://www.typo3.net/d/80598-absatzformatierung-in-tabellen/2) · Niklas Lazinbee · 2008-08-23

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

```typoscript
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

---

Quelle: „Absatzformatierung in Tabellen“, typo3.net, https://www.typo3.net/d/80598-absatzformatierung-in-tabellen
Beiträge von Mitgliedern des Forums. Bitte mit Link auf die Diskussion zitieren.
