Stylesheets icon indicating copy to clipboard operation
Stylesheets copied to clipboard

teitodocx​​ does not​ ​correctly ​handle ​​rows attribute of​ ​a table​ ​cell

Open RayCHOU opened this issue 8 years ago • 2 comments

I have a TEI table​ shown like as following: ​

<table>
  <row>
     <cell>A</cell>
     <cell rows="2">B</cell>
  </row>
  <row>
     <cell>C</cell>
  </row>
</table>

I ​try to ​use teitodocx​​ to convert this ​TEI file to docx​ format​​, and I expect to get result like: 1

But result is: 2

any suggestions?​

RayCHOU avatar Mar 23 '17 03:03 RayCHOU

Tested and confirmed that the result is as you say. (Well, in my case the C cell stretches the full width....) I tried a variety of likely markup to see if that triggered a conversion spanning rows and it didn't, so I looked at the XSL.

If someone is trying to fix this the table-handling in teitodocx.xsl is at https://github.com/TEIC/Stylesheets/blob/dev/docx/to/teitodocx.xsl#L1237 and the templates for rows and cells at https://github.com/TEIC/Stylesheets/blob/dev/docx/to/teitodocx.xsl#L1399

I think it has logic built in for @cols but doesn't do anything with @row. There is, in calculating the table borders some handling of html:colGroup and cals: tables but again I think this is handling column spanning and grouping rather than row spanning. Fixing it is non-trivial I think because it will conflict with the way we're doing the column spanning.

@RayCHOU: I recognise confirming that it doesn't work (and seeing that the XSLT doesn't handle @rows) isn't much help. If you need to get lots of TEI tables as marked up in your example I would probably suggest transforming them to two nested tables. If you don't have many of them, then I'd be tempted to suggest changing them by hand after the fact.

jamescummings avatar Mar 23 '17 11:03 jamescummings

Does anyone had some ideas on this meanwhile or are there other approaches than nest two tables (which seams too dirty for me)?

In a single-source publishing project there will be a lot of 300 pages Word documents with around 50-80 tables each, many of them using a complicated table structure. Fixing it by hand will be a lot of work and it will be open ended.

I would be willing to have a look at the XSLT though at the moment it is out of my technical capacity.

Cutuchiqueno avatar Nov 19 '18 14:11 Cutuchiqueno