mirror of
https://github.com/tfussell/xlnt.git
synced 2024-03-22 13:11:17 +08:00
Fix for the "index out of bounds" exception while reading styles
There was a bug introduced in version 1.2 in reading styles. As from the Office Open XML documentation: Every cell will have a reference to one <xf> in the <cellXfs> collection. This is direct formatting for the cell. To apply a style to the cell, the <xf> references the style using the xfId attribute. The xfId attribute is an index into the <cellStyleXFs> collection, which collects the cell styles available to the user. The <cellStyleXFs> contains one <xf> for each style. Each such <xf> is tied to its name via an index (in its xfId attribute) from the <cellStyles> collection. Existing implementation simply tried to fetch a style name by using index in the styles vector causing an index_out_of_range exception for each xfId that was ot of bounds of cellStyles collection. What was needed is to match the xfId attribute of the cellStyle element.
This commit is contained in:
parent
b899c9db5c
commit
6b668fd04e