- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Keeping line breaks in PDF output channel in a table cell
FirstSpirit version 5.1.316.66338
I am having difficulty with tables in the PDF output channel. If a table cell contains line breaks (<br /> in the HTML), these line breaks are ignored in the PDF version of the page. This is a problem when displaying addresses in tables. It is easier to explain with some pictures:
The table as it appears in the WebEdit client:
The table as it appears in a PDF:
I can think of two possibilities:
- a problem with the Unicode to FOP Entities conversion channel, possibly removing the <br> characters
- a problem with the FOP instructions. I have tried adding linespace-treatment="preserve", white-space-treatment="preserve" to the
<fo:block padding="0mm"
margin="0mm">
$CMS_VALUE(#content)$
</fo:block>
, but this hasn't helped.
Here is the PDF channel for the Table Section Template: (we are not using the table format template, I think)
<CMS_HEADER>
<CMS_FUNCTION name="define" resultname="fr_cell_align">
<CMS_CDATA_PARAM name="source">
<![CDATA[
$CMS_IF(#style.isNull)$
$CMS_IF(!#cell.align.isEmpty)$
text-align="$CMS_VALUE(#cell.align)$"
$CMS_ELSE$
text-align="left"
$CMS_END_IF$
$CMS_ELSE$
text-align="left"
$CMS_END_IF$
]]>
</CMS_CDATA_PARAM>
</CMS_FUNCTION>
<CMS_FUNCTION name="Table" resultname="fr_st_table">
<CMS_PARAM name="tableData" value="st_table" />
<CMS_NODE_PARAM name="tableFormat">
<HEADERSPEC>
<![CDATA[
<fo:table
table-layout="fixed"
width="100%"
border-width="0.3mm"
border-style="solid"
border-color="#A9A9A9"
border-collapse="collapse">
$CMS_FOR(cols, [1..#table.cols])$
<!-- This sets the width of the Columns -->
<fo:table-column column-width="$CMS_VALUE(168/#table.cols)$mm"/>
$CMS_END_FOR$
<!-- table-body is the container for the Table Rows and Cells -->
<fo:table-body>$CMS_VALUE(#content)$</fo:table-body>
</fo:table>
]]>
</HEADERSPEC>
<ROW number="ALL">
<![CDATA[
<!-- Defines each Table Row -->
<fo:table-row>
$CMS_VALUE(#content)$
</fo:table-row>
]]>
</ROW>
<!-- Table Header -->
<CELL row="0" col="ALL">
<![CDATA[
$CMS_IF(st_header_required)$
<fo:table-cell
$CMS_IF(!#cell.colspan.isEmpty && #cell.colspan > 0)$
number-columns-spanned="$CMS_VALUE(#cell.colspan)$"
$CMS_END_IF$
$CMS_IF(!#cell.rowspan.isEmpty && #cell.rowspan > 0)$
number-rows-spanned="$CMS_VALUE(#cell.rowspan)$"
$CMS_END_IF$
border-width="0.3mm"
border-style="solid"
border-color="#A9A9A9"
background-color="#000"
color="#FFFFFF"
border-collapse="collapse"
$CMS_VALUE(fr_cell_align)$
padding="1mm"
min-height="4mm">
<fo:block-container
padding="0mm"
margin="0mm"
overflow="hidden"
font-weight="bold"
font-size="8px">
<fo:block>$CMS_VALUE(#content)$</fo:block>
</fo:block-container>
</fo:table-cell>
$CMS_ELSE$
<fo:table-cell
$CMS_IF(!#cell.colspan.isEmpty && #cell.colspan > 0)$
number-columns-spanned="$CMS_VALUE(#cell.colspan)$"
$CMS_END_IF$
$CMS_IF(!#cell.rowspan.isEmpty && #cell.rowspan > 0)$
number-rows-spanned="$CMS_VALUE(#cell.rowspan)$"
$CMS_END_IF$
border-width="0.3mm"
border-style="solid"
border-color="#A9A9A9"
background-color="#FFFFFF"
border-collapse="collapse"
padding="1mm"
$CMS_VALUE(fr_cell_align)$
font-size="8px"
min-height="4mm">
<fo:block padding="0mm"
margin="0mm">
$CMS_VALUE(#content)$
</fo:block>
</fo:table-cell>
$CMS_END_IF$
]]>
</CELL>
<!-- Odd Rows in all Columns -->
<CELL row="odd" col="ALL">
<![CDATA[
<fo:table-cell
$CMS_IF(!#cell.colspan.isEmpty && #cell.colspan > 0)$
number-columns-spanned="$CMS_VALUE(#cell.colspan)$"
$CMS_END_IF$
$CMS_IF(#cell.rowspan > 1 && #table.cols != #cell.colspan)$
number-rows-spanned="$CMS_VALUE(#cell.rowspan)$"
$CMS_END_IF$
border-width="0.3mm"
border-style="solid"
border-color="#A9A9A9"
$CMS_IF(st_header_required)$
background-color="#FFFFFF"
$CMS_ELSE$
background-color="#D9D9D9"
$CMS_END_IF$
border-collapse="collapse"
padding="1mm"
$CMS_VALUE(fr_cell_align)$
font-size="8px"
min-height="4mm">
<fo:block padding="0mm"
margin="0mm">
$CMS_VALUE(#content)$
</fo:block>
</fo:table-cell>
]]>
</CELL>
<!-- All Rows -->
<CELL row="ALL" col="ALL">
<![CDATA[
<fo:table-cell
$CMS_IF(!#cell.colspan.isEmpty && #cell.colspan > 0)$
number-columns-spanned="$CMS_VALUE(#cell.colspan)$"
$CMS_END_IF$
$CMS_IF(#cell.rowspan > 1 && #table.cols != #cell.colspan)$
number-rows-spanned="$CMS_VALUE(#cell.rowspan)$"
$CMS_END_IF$
border-width="0.3mm"
border-style="solid"
border-color="#A9A9A9"
$CMS_IF(st_header_required)$
background-color="#D9D9D9"
$CMS_ELSE$
background-color="#FFFFFF"
$CMS_END_IF$
background-color="#FFFFFF"
border-collapse="collapse"
padding="1mm"
$CMS_VALUE(fr_cell_align)$
font-size="8px"
min-height="4mm">
<fo:block padding="0mm"
margin="0mm">
$CMS_VALUE(#content)$
</fo:block>
</fo:table-cell>
]]>
</CELL>
</CMS_NODE_PARAM>
</CMS_FUNCTION>
</CMS_HEADER>
$-- This actually places the table on the PDF --$
<fo:block space-after="3mm" space-before="3mm">
$CMS_IF(!st_table_caption.isEmpty)$
$CMS_VALUE(st_table_caption)$
$CMS_END_IF$
$CMS_IF(!st_headline.isEmpty)$
<fo:block space-after="2mm">
<fo:inline font-size="9pt"
font-weight="bold"
color="#000">
$CMS_VALUE(st_headline.convert)$
</fo:inline>
</fo:block>
$CMS_END_IF$
$-- Show the whole table using fr_st_table --$
$CMS_VALUE(fr_st_table)$
$CMS_IF(!st_underline.isEmpty)$
$CMS_VALUE(st_underline)$
$CMS_END_IF$
$CMS_VALUE(st_table_format_text)$
</fo:block>
For reference, here is the table in the Java client. Our editors never use the Java client though:
- Labels:
-
Developers
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Liam,
linebreaks are handled by the format template "br", there is no "character conversion", linebreaks are always replaced by the content of the "br" format template.
Does your "br" format template contain any code in the PDF channel?
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Liam,
linebreaks are handled by the format template "br", there is no "character conversion", linebreaks are always replaced by the content of the "br" format template.
Does your "br" format template contain any code in the PDF channel?
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, thank you. There was some code in the "br" format template, but not the right code. Changed it to <fo:block>$CMS_VALUE(#content)$</fo:block>.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Liam,
it should be enough to just use
<fo:block />
as the br format never has content.
Michael

