Created attachment 145229 [details] Example file from Excel If we set the text orientation in a Microsoft Excel cell to 45° or -45° the text alignment will be left and right. Steps to reproduce: 1. Create a new spreadsheet with Microsoft Excel 2010/2013/2016 2. Fill the A1 and A2 cell with some text 3. Set the text orientation of A1 cell to 45° and A2 to -45° (the text will be automatically left and right align) 4. Save the file as *.xlsx 5. Open the file with LibreOffice Calc Actual results: The text alignment will be center at the A1 and A2 cell Expected results: The text alignment should be left at the A1 cell and right at the A2 cell. Version: 6.2.0.0.alpha0+ Build ID: a27ae800fed5a974c9b255f7ce2b38ec2dbaa426 CPU threads: 4; OS: Windows 6.3; UI render: default; Locale: hu-HU (hu_HU); Calc: CL
Created attachment 145230 [details] Screenshot of the document in Excel and Calc side by side
If you set format cells > alignment > reference edge to '[...] From Upper Cell Border' then it works. Does excel set (and save) such an option or does it just automatically set this when setting the text orientation ??? If excel doesn't have/save the option, calc can't load it...
(In reply to MM from comment #2) > If you set format cells > alignment > reference edge to '[...] From Upper > Cell Border' then it works. > Does excel set (and save) such an option or does it just automatically set > this when setting the text orientation ??? > If excel doesn't have/save the option, calc can't load it... There is no similar explicit setting on the UI, see here: https://www.homeandlearn.co.uk/excel2007/excel2007s1p5.html https://www.homeandlearn.co.uk/excel2007/images2016/opening/format_cells_dialogue_box.gif The sheet1.xml contains this: <sheetData><row r="1" spans="1:2" ht="39" customHeight="1" x14ac:dyDescent="0.25"><c r="A1" s="1" t="s"><v>0</v></c><c r="B1" s="2" t="s"><v>0</v></c></row><row r="2" spans="1:2" ht="39" customHeight="1" x14ac:dyDescent="0.25"><c r="A2" s="1" t="s"><v>1</v></c><c r="B2" s="2" t="s"><v>1</v></c></row></sheetData> I don't see here or elsewhere in the file a similar setting stored. I'd guess it's just heuristics.
18.8.1 alignment (Alignment) section in the ISO/IEC 29500-1:2016(E) standard says: --- textRotation (Text Rotation) Text rotation in cells. Expressed in degrees. Values are in the range 0 to 180. The first letter of the text is considered the center-point of the arc. For 0 - 90, the value represents degrees above horizon. For 91-180 the degrees below the horizon is calculated as: [degrees below horizon] = 90 - textRotation. --- And it provides a few screenshots about how different values look: 45 - text starts in the bottom left corner, vertically aligned left 90 - text starts in the bottom right corner, vertically aligned right 135 - text ends in the bottom right corner, vertically aligned right 180 - text ends in the bottom left corner, vertically aligned left Also there are more attributes defined: --- horizontal (Horizontal Alignment) Specifies the type of horizontal alignment in cells. vertical (Vertical Alignment) Vertical alignment in cells. --- But these two are not present in my example files styles.xml, only textRotation is, with 45 and 135 values: <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment textRotation="45"/></xf> and <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyAlignment="1"><alignment textRotation="135"/></xf>
Reproduced in Version: 6.2.0.0.alpha0+ Build ID: 8ea0b0f4dc5eba2d0bafc2e42415ef1824ff604e CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; Locale: ca-ES (ca_ES.UTF-8); Calc: threaded Version: 5.2.0.0.alpha0+ Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53 Threads 4; Ver: 4.10; Render: default; Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a) LibreOffice 3.3.0 OOO330m19 (Build:6) tag libreoffice-3.3.0.4
(In reply to Gabor Kelemen from comment #4) > But these two are not present in my example files styles.xml, only > textRotation is, with 45 and 135 values: > <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" > applyAlignment="1"><alignment textRotation="45"/></xf> > and > <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" > applyAlignment="1"><alignment textRotation="135"/></xf> Does that mean Excel is not respecting the standard ?
(In reply to MM from comment #6) > (In reply to Gabor Kelemen from comment #4) > > > But these two are not present in my example files styles.xml, only > > textRotation is, with 45 and 135 values: > > <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" > > applyAlignment="1"><alignment textRotation="45"/></xf> > > and > > <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" > > applyAlignment="1"><alignment textRotation="135"/></xf> > > Does that mean Excel is not respecting the standard ? No, I don't mean that. That's just a set of possible parameters that looked relevant in the documentation, but not even those are written to the file. That's fine.
I think I have a simple fix by adapting the default horizontal alignment based on the rotation value. I need to double check with a MSO version whether this covers all cases.
Markus Mohrhard committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/+/d278f59c6112d39ae0f0cf23ec04697d87bbf870%5E%21 tdf#120168, adapt horizontal alignment based on text rotation It will be available in 6.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Verified fixed in Version: 6.2.0.0.alpha1+ (x64) Build ID: 50519e036a2707aca59cc8a7b58c4fdd7aeff580 Markus, Any reason you want this left open?
I see similar behavior in 6.2.0.0.beta1. However, it is unrelated to opening an Excel file. It happens with spreadsheets created as .ods files. By the way, here are other reports of similar issues with horizontal alignment. I am not sure how they should be included here. Bug 53654 - FORMATTING: Format Cells dialog; Alignment tab; Text orientation Bug 38446 - Text orientation<> 0 + particlar 'Reference Edge' destroys horizontal text alignment Bug 120168 - FILEOPEN XLSX: Text Orientation and alignment in cells
Dear Markus Mohrhard, This bug has been in ASSIGNED status for more than 3 months without any activity. Resetting it to NEW. Please assigned it back to yourself if you're still working on this.
Created attachment 166080 [details] The example file in Excel 13 and LO 6.3 Works fine in 6.3.
Xisco Fauli committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/691aaa442f0c41cedf230d71fc10802c0c5508b8 tdf#120168: sc_subsequent_export: Add unittest It will be available in 7.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.