The order of setting a border can corrupt the style. #304
Labels
enhancement
New feature or request
ready to close
Pull request has been answered or implemented & is pending closure
testing
Functionality has been implemented in development branch and is pending a merge into main
It seems excel expects the border to be in the order left, right, top, bottom, diagonal in the styles.xml file. If it's not in this order then excel will give an error saying the style is corrupted. The order of the styles in OpenXLSX is determined by the order they are set in code. So if the Top, Bottom are set then the Right is set, the file cannot be opened in excel.
Works
auto leftBorder = borders.create(); borders[leftBorder].setOutline(true); borders[leftBorder].setLeft(OpenXLSX::XLLineStyleThin, OpenXLSX::XLColor("ff000000")); borders[leftBorder].setTop(OpenXLSX::XLLineStyleThin, OpenXLSX::XLColor("ff000000")); borders[leftBorder].setBottom(OpenXLSX::XLLineStyleThin, OpenXLSX::XLColor("ff000000"));
Corrupts Style
auto leftBorder = borders.create(); borders[leftBorder].setOutline(true); borders[leftBorder].setTop(OpenXLSX::XLLineStyleThin, OpenXLSX::XLColor("ff000000")); borders[leftBorder].setBottom(OpenXLSX::XLLineStyleThin, OpenXLSX::XLColor("ff000000")); borders[leftBorder].setLeft(OpenXLSX::XLLineStyleThin, OpenXLSX::XLColor("ff000000"));
The text was updated successfully, but these errors were encountered: