drmacro / wordinator

Generate high-quality DOCX files using a simplified XML format (simple word processing XML).
Apache License 2.0
38 stars 8 forks source link

Failure on empty colwidth value #13

Closed drmacro closed 4 years ago

drmacro commented 5 years ago

Re "Unexpected StringIndexOutOfBoundsException: String index out of range: -2", I've found out what it is. It's due to . I've fixed it by not generating colwidth if not specified. I do get the following warning in this case:

[WARN ] Widths of spanned columns are neither all percents or all measurements, cannot calculate exact spanned width [WARN ] Widths are "auto", "auto", "auto", "auto", "auto"

It generates the table fine, but you may still want to check and eventually remove the warning in this case.

drmacro commented 5 years ago

Set width to "auto" if width value is an empty string. Note that this case is almost certainly a generation error--the swpx should have a real value, probably a percentage, but this will prevent a hard failure.

drmacro commented 5 years ago

Handled message about all auto by translating auto to equal percentages when all values are auto. This will work when the spanned cell spans the entire table but probably won't work in other cases, but in those cases you really need explicit measurements so this is probably a reasonable solution.

drmacro commented 4 years ago

I think this is resolved now.