openhtmltopdf icon indicating copy to clipboard operation
openhtmltopdf copied to clipboard

dir="auto" does not affect the table tag

Open syedkaleem29 opened this issue 7 years ago • 9 comments

It does not cause the table column itself to be rendered from Right to Left. Because of which the layout in the browser and the PDF differs a lot.

Consider a cell which appears on the left side for English. Now when the pdf language changes to Arabic the cell must come on the right and the text within that should be RTL.

But what actually happens is the cell stays left and the text within the cell is RTL.

i.e., The columns do not run from right to left in tables when the tag is dir="auto"/"rtl"

HTML image PDF image

syedkaleem29 avatar Sep 06 '17 04:09 syedkaleem29

Hi @syedkaleem29

This is noted somewhere, probably in the RTL issue. The problem is that with row spans and col spans, the table code is quite complex.

danfickle avatar Sep 26 '17 11:09 danfickle

Hi, any news on this issue?

ieugen avatar Dec 04 '19 12:12 ieugen

Hello any news? @danfickle

AhmedEzzat12 avatar Jun 08 '20 19:06 AhmedEzzat12

It seems we need to push this up the priority list.

danfickle avatar Jun 13 '20 06:06 danfickle

It seems we need to push this up the priority list.

Yes thanks, it's a key feature without it RTL is not really complete it's not only about text.

AhmedEzzat12 avatar Jun 14 '20 09:06 AhmedEzzat12

Hello @danfickle any updates here?

daniil-tagan avatar May 27 '21 07:05 daniil-tagan

@danfickle any update about RTL Direction of table?? i need Urgent Can you Please solved in these days

wahab321 avatar Dec 06 '21 05:12 wahab321

Hello @wahab321 . If you are looking for urgent soution you may replace the following code in TableSectionBox.java Inside setCellWidths function at line 217 write:

sourse: cell.setX(columnPos[j] + hspacing);

new code for RTL tables only: Box parent = getTable().getParent();

if(parent != null){ int parentWidth = parent.getContentWidth(); cell.setX(parentWidth - w - (columnPos[j] + hspacing)); }

It solved for me an alignment issue in RTL tables. I don't know if it is a right solution, but I checked it with simple tables without colspan/rowspan and it works. At least you can use it until you get a real solution from @danfickle

mike-mike avatar Dec 06 '21 06:12 mike-mike

thanks it work's for me

wahab321 avatar Dec 12 '21 09:12 wahab321