OpenXML: make char constraints work when translating in-place

The dynamic sizing constraints improvement to XLSX handling had another issue: it didn't work correctly if you were translating in-place.

If you did something like:

worksheetConfigurations.0.namePattern=.*?
worksheetConfigurations.0.sourceColumns=A
worksheetConfigurations.0.targetColumns=
worksheetConfigurations.0.targetColumnsMaxCharacters=B

the filter would extract the source from column A, but not apply the constraint from column B. If, instead, you tried:

worksheetConfigurations.0.namePattern=.*?
worksheetConfigurations.0.sourceColumns=A
worksheetConfigurations.0.targetColumns=A
worksheetConfigurations.0.targetColumnsMaxCharacters=B

this would extract nothing at all, due to pre-existing behavior that if target column is specified, we expect it to != the source column.

In this process of fixing this, we discovered another issue: the target constraints only affected columns that appeared after the constraint.

To fix this, the PR contains two changes:

  1. The main fix - if no targetColumns are specified, apply any constraints to sourceColumns. (This also works if there are multiple source columns/constraints, as you would expect.
  2. Make the ordering independent by pre-scanning the row and applying constraints.

Merge request reports

Loading