Bug 87889 - FILEOPEN: Vertical alignment settings of table content not possible for docx/doc files created with MSO
Summary: FILEOPEN: Vertical alignment settings of table content not possible for docx/...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.4.0.1 rc
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:5.1.0
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-31 02:52 UTC by Kevin Suo
Modified: 2016-10-25 19:19 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
test DOCX file, created with MSO 2010 (13.06 KB, application/vnd.openxmlformats-officedocument.wordprocessingml)
2014-12-31 02:53 UTC, Kevin Suo
Details
screenshot (14.73 KB, image/png)
2015-01-01 17:36 UTC, yanjingtao
Details
test DOC file, created with MSO 2013 (26.50 KB, application/msword)
2015-01-03 15:37 UTC, yanjingtao
Details
Default template in mso 2013 pro plus zh_CN 64bit (17.89 KB, application/vnd.ms-word.template.macroEnabled.12)
2015-01-05 01:51 UTC, yanjingtao
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Suo 2014-12-31 02:52:02 UTC
LibreOffice is not able to set the table content vertical alignments for DOCX/DOC files created with Microsoft Word.

Steps to reproduce:
1. Insert a 2x2 table in Microsoft Word 2010, and set a bigger row heigt for the rows.
2. Type in some text in each of the table cells, then save as the default DOCX format. (Or you can use my attached test docx file)
3. Open with LibreOffice, try to change the vertical alignment settings. (Select table text, right-click -> Table -> Text Flow -> Vertical Alignment)

Current Behaviour:
Not possible to set Vertical Alignment in step 3.

Expected Behaviour:
Vertical alignment of table cell contents changes when you change the settings.

Note:
* Vertical Alignment works OK with ODT files.
* The workaround is to set the "Format - Page - Text Grid" to "No Grid".

My version: 4.4.0.1
Build ID: 1ba9640ddd424f1f535c75bf2b86703770b8cf6f
Locale: zh_CN
Win 7 X86

This issue was first reported in the LibreOffice Chinese community forum:
http://www.libreofficechina.org/thread-804-1-1.html
and was confirmed to be reproducible in:

4.2.7.2
Build ID: 420m0(Build:2)
Linux Mint 17 X64

MacOS X 10.10.1
LibreOffice Version: 4.4.0.1
Comment 1 Kevin Suo 2014-12-31 02:53:36 UTC
Created attachment 111550 [details]
test DOCX file, created with MSO 2010

This file was created by MSO 2010, using the default blank template.
Comment 2 Cor Nouws 2014-12-31 10:48:04 UTC
He Kevin,

Thanks for the clear report and testfile.

However, I can't reproduce it in 4.2.7.2 and 4.3.5.2 on Ubuntu..

If I select text, or not, or the whole table, in all cases I can do the job via the dialog table (as you mention) ad directly via context menu > Cell ..

Cor
Comment 3 yanjingtao 2015-01-01 17:36:08 UTC
Created attachment 111618 [details]
screenshot
Comment 4 yanjingtao 2015-01-01 17:38:41 UTC
Hi Cor,
   I have reproduce in 4.4.0.1(windows 8.1),look at the attachment 111618 [details], I have set the grid to Vertical Alignment.

PS:
   I found when I save as this file to an odt format, it cannot set vertical alignment either.
Comment 5 Cor Nouws 2015-01-01 22:27:27 UTC
Hi yanjingtao,

interesting that you can confirm this :)
I can't.
I guess in your situations it is for al documents?
Maybe language dependent ??
Comment 6 yanjingtao 2015-01-02 08:43:53 UTC
Hi Cor,
   I have changed my language to en(US),but I can reproduce it too.
Comment 7 V Stuart Foote 2015-01-02 14:48:44 UTC
On Windows 7 sp1, 64-bit en-US
with
Version: 4.4.0.0.beta2
Build ID: be92f32b8f21603a6b7a75dd645f7475bdee519d
Locale: en_US

only reproducible when opening the attached DOCX file-- https://bugs.freedesktop.org/attachment.cgi?id=111550

Vertical paragraph alignment within the existing 4 cell (2x2) table can not be set. Horizontal alignment does work. Also, if a new 2x2 table is inserted when editing in LO Writer, vertical alignment of paragraphs in those cells can *not* be set.

However, it is not reproducible with a new LO Writer document. Paragraphs in the cells of a new 2x2 table respond correctly to any of the 3 vertical alignment buttons.

Nor is it reproducible with a new Word 2007created DOCX. Paragraphs in cells in a newly created table respond correctly to to both horizontal and vertical alignment.
 
Nor is it reproducible with Office365 Word newly created DOCX. Paragraphs in cells in newly created table respond correctly to alignment there as well.

@Kevin, could there be anything special about the MS Word nomal.dot you are using that could be suppressing vertical alignment within tables?
Comment 8 yanjingtao 2015-01-03 15:37:40 UTC
Created attachment 111688 [details]
test DOC file, created with MSO 2013
Comment 9 V Stuart Foote 2015-01-03 17:42:13 UTC
@Kevin, @yanjingtao, *,

Confirmed the same issue with the MS Office 97-2003 formatted .DOC document of attachment 111688 [details]

Of note though, in the TableAlignment.docx\word\settings.xml OOXML settings for the document, I found this value:

<w:compatSetting w:name="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1"/>

http://msdn.microsoft.com/en-us/library/dd944611%28v=office.12%29.aspx

When I revert the "1" true, to "0" false; table cell paragraphs honor alignment settings in LibreOffice.  I am not sure, but I suppose this could be a value set for CJK versions of Microsoft Office, and a part of the normal.dot used?

Anyone up to speed on what MS does for localizing the Word products?
Comment 10 Cor Nouws 2015-01-03 20:02:09 UTC
(In reply to V Stuart Foote from comment #7)
> 
> only reproducible when opening the attached DOCX file--
> https://bugs.freedesktop.org/attachment.cgi?id=111550

I used this file too, of course. The description was clear.
But I can't reproduce. 
I see only confirmation on Windows?
Comment 11 yanjingtao 2015-01-05 01:51:37 UTC
Created attachment 111742 [details]
Default template in mso 2013 pro plus zh_CN 64bit
Comment 12 yanjingtao 2015-01-05 01:53:20 UTC
@ V Stuart Foote
I can find Normal.dotm only in my computer, the key "overrideTableStyleFontSizeAndJustification" in this file is 1 by default.
Comment 13 yanjingtao 2015-01-05 01:56:38 UTC
@Cor
How about attachment 111688 [details] ?
Comment 14 Mark Hung 2015-07-09 23:38:40 UTC
This issues is related to tdf#77961 and tdf#92535. 

I've seen that MS Word ( at least for traditional Chinese version ) has text grid on and snap to grid for every paragraph off by default, but seems as if text grid turn off on UI. That's why tdf#77961 said "ODT exported from MS Office has text grid enabled".

On the other hand tdf#92535 affect the vertical alignment function that it always align to top when text grid is on.

Put them together, .doc and .docx files created by MS Word wont't align properly.

For CJK users, my best advice is to turn of the text grid from page style before tdf#92535 been fixed.
Comment 15 Commit Notification 2015-08-16 17:08:09 UTC
Mark Hung committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7e383cb50c6020b86ac7857ece8a6273b7eb1a5e

Fix tdf#87889 and tdf#92535, vertical align issue when docgrid enable.

It will be available in 5.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 16 Kevin Suo 2015-12-03 05:19:54 UTC
Tested fixed in:

Version: 5.1.0.0.beta1-buildfix1 (x64)
Build ID: 13010a13177025f633c9b85adcb3edf6920e44e3
Threads 4; Ver: Windows 6.19; Render: GL; 
Locale: zh-CN (zh_CN)

Set to RESOLVED FIXED.
@Mark Hung: Any plan to backport this to version 5.0 (or even 4.4.8)? Thanks.

P.S. Version 5.1.0.0.beta1-buildfix1 currently has a bug which prevent you from selecting the vertical alignment settings using your mouse -  You your UP and DOWN key instead.