-
Mike Kaganski yazdı
For some reason, we have never exported the default column width to XLSX, although we have such export for XLS. This led to bugs like tdf#100946. Workarounds applied to those bugs have made LO to export columns which shouldn't have been exported, abusing "customWidth" attribute in XclExpColinfo::XclExpColinfo depending on if the column has size different from an app-global default; after that, sheet-local default was determined, and then columns which have mbCustomWidth set (i.e., different from app default), as well as those different from sheet-local default, were stored. Effectively, the hack had disabled the removal of defaults from maColInfos in XclExpColinfoBuffer::Finalize. We even had unit tests explicitly testing that we export those columns that Excel skips. The effect of that is not only unnecessary data in the file; the data was actually wrong (customWidth actually means that the width was edited manually by user, even if equal to the default, thus changing Excel handling of the column); and also Calc initializes all columns to the right of last used column for such a file. Only in case when app-global default happened to match sheet-local one, columns would have properties allowing them to be removed from maColInfos in the end of XclExpColinfoBuffer::Finalize, which still resulted in problems similar to the workarounded one. This patch implements proper export of the default column width to XLSX, thus partially reverting changes made for tdf#100946 in commit 40d892a2. Actually, our export to XLSX does not depend on the 5-pixel correction (see ECMA-376-1:2016 18.3.1.81), since the exported default depends only on most-used column width. XclExpDefcolwidth implementation was edited to only take the correction into account when exporting to XLS (to keep status quo; it's clear that XLS widths export and import implementation is incorrect: some empirical formula is used in XclTools::GetXclDefColWidthCorrection, that was introduced in commit 555d7029 for i#3006, that doesn't match any documentation, and changes widths of columns in exported XLS - something to be fixed independently). Change-Id: I227aca17e56247cbb839444717066a898987c4f1 Reviewed-on: https://gerrit.libreoffice.org/71132Reviewed-by:
Mike Kaganski <mike.kaganski@collabora.com> Tested-by:
Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/71222
225e10cd