OpenXML Filter: DOCX: style conditional table formatting is unconsidered

Here is an example document: style-conditional-table-formatting.docx

The original UI:

image

The UI after round-tripping with default parameters:

image

This is happening because the filter does not support style conditional table formatting.

So, table conditional formats are applied to different regions of the table as follows:

image

All rows in the table can also have conditional formatting on an alternating row/column basis as follows:

image

When specified, these conditional formats shall be applied in the following order (therefore, subsequent formats override properties on previous formats):

  • Whole table
  • Banded columns, even column banding
  • Banded rows, even row banding
  • First row, last row
  • First column, last column
  • Top left, top right, bottom left, bottom right

Workarounds (code changes should still be provided):

  1. Link the allowWordStyleOptimisation parameter with run properties minimisation on parsing them. So, when the parameter is set to false, the formatting remains unoptimised but consistent with the original.
  2. Every run of text (<w:t>) in a table cell can be prepended with empty run properties, if they are not present: <w:rPr/>.