Table cell centered text issue
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 3
- Joined: Thu Feb 13, 2025 6:48 am
Table cell centered text issue
I'm trying to center text in tbody cells. So I added <xsl:attribute name="text-align"></xsl:attribute> to the attribute set "tbody.row.entry__content" in tables-attr.xsl.
I'm writing in Chinese. If the text in a table cell is longer for one line to hold, it will be in two lines. The thing is, the second line will always be a bit to the right than the first line, such as:
测试测试测试
(two spaces here)测试测试测试
If the text is generated into multiple lines, only the last line is a bit to the right compared to other lines, such as:
测试测试测试
测试测试测试
测试测试测试
(two spaces here)测试测试测试
Can anyone help? Thank!
I'm writing in Chinese. If the text in a table cell is longer for one line to hold, it will be in two lines. The thing is, the second line will always be a bit to the right than the first line, such as:
测试测试测试
(two spaces here)测试测试测试
If the text is generated into multiple lines, only the last line is a bit to the right compared to other lines, such as:
测试测试测试
测试测试测试
测试测试测试
(two spaces here)测试测试测试
Can anyone help? Thank!
-
- Posts: 688
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Table cell centered text issue
Post by julien_lacour »
Hello,
I guess you're using the DITA Map PDF - based on XSL-FO scenario. Why not using directly DITA @align attribute inside the table?
Regards,
Julien
I guess you're using the DITA Map PDF - based on XSL-FO scenario. Why not using directly DITA @align attribute inside the table?
Code: Select all
<table id="table_ibs_ncc_dgc" frame="all">
<tgroup cols="3">
<colspec colnum="1" colname="c1" colwidth="1*" align="center" colsep="1" rowsep="1"/>
<colspec colnum="2" colname="c2" colwidth="1*" align="center" colsep="1" rowsep="1"/>
<colspec colnum="3" colname="c3" colwidth="1*" align="center" colsep="1" rowsep="1"/>
<tbody>
<row>
<entry>测试测试测试 测试测试测试</entry>
<entry>测试测试测试 测试测试测试</entry>
<entry>测试测试测试 测试测试测试</entry>
</row>
<row>
<entry>测试测试测试 测试测试测试 测试测试测试 测试测试测试</entry>
<entry>测试测试测试 测试测试测试 测试测试测试 测试测试测试</entry>
<entry>测试测试测试 测试测试测试 测试测试测试 测试测试测试</entry>
</row>
</tbody>
</tgroup>
</table>
Julien
-
- Posts: 3
- Joined: Thu Feb 13, 2025 6:48 am
Re: Table cell centered text issue
Hi Julien, thanks for your reply.julien_lacour wrote: ↑Mon Jul 28, 2025 10:51 am Hello,
I guess you're using the DITA Map PDF - based on XSL-FO scenario. Why not using directly DITA @align attribute inside the table?Regards,Code: Select all
<table id="table_ibs_ncc_dgc" frame="all"> <tgroup cols="3"> <colspec colnum="1" colname="c1" colwidth="1*" align="center" colsep="1" rowsep="1"/> <colspec colnum="2" colname="c2" colwidth="1*" align="center" colsep="1" rowsep="1"/> <colspec colnum="3" colname="c3" colwidth="1*" align="center" colsep="1" rowsep="1"/> <tbody> <row> <entry>测试测试测试 测试测试测试</entry> <entry>测试测试测试 测试测试测试</entry> <entry>测试测试测试 测试测试测试</entry> </row> <row> <entry>测试测试测试 测试测试测试 测试测试测试 测试测试测试</entry> <entry>测试测试测试 测试测试测试 测试测试测试 测试测试测试</entry> <entry>测试测试测试 测试测试测试 测试测试测试 测试测试测试</entry> </row> </tbody> </tgroup> </table>
Julien
Yes. I am using xsl-fo. The issue is that no matter what you want to align, you need to set text-align attribute of the the entry content to center. If I do that, and the entry contains a continuous text that is broken into multiple lines due to not enough space, the last line will not be correctly aligned. Please see my example below:
In oxygen:
in-oxygen.jpeg
In PDF:
in-pdf.jpeg
Regards,Eric
You do not have the required permissions to view the files attached to this post.
-
- Posts: 688
- Joined: Wed Oct 16, 2019 3:47 pm
Re: Table cell centered text issue
Post by julien_lacour »
Hi Eric,
It is not necessary to use the text-align attribute on table cells.
You just need to use the @align attribute: either on <colspec> elements or directly on <entry> elements.
If you replace the outputclass by align, you will get the correct output.
Regards,
Julien
It is not necessary to use the text-align attribute on table cells.
You just need to use the @align attribute: either on <colspec> elements or directly on <entry> elements.
If you replace the outputclass by align, you will get the correct output.
Regards,
Julien
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service