Issue 119464

Summary: [From Symphony]text alignment changed from left to center when importing the docx
Product: Writer Reporter: zongdj <zongdongjun>
Component: formattingAssignee: mayongl <mayongl>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: binbjguo, liushenf, mayongl, tldyzem, yanji.yj
Version: 3.4.0 Beta (OOo)   
Target Milestone: 4.0.0   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
sample file for this bug
none
code patch for default paragraph alignment
none
Patch for paragraph alignment issue
none
Patch for paragraph alignment issue
none
UT case been tested none

Description zongdj 2012-05-29 01:57:11 UTC
Created attachment 77648 [details]
sample file for this bug

Build:
Aoo3.4

Steps:
1.Open the attachecd sample file in Aoo3.4
2.Check the text alignment on page 1

Bug:
The alignment change to center when open in Aoo3.4
Comment 1 Yolanda Zhang Ying 2012-06-05 05:49:34 UTC
In the sample, the issued paragraph been applied with Title style, and the definition for the Title style use the alignment of Left by default.
And also, in OOXML file, the title style has no <w:jc> settings in style.xml, which the token represent the alignment property, and no settings means set to left.
But in AOO, if no <w:jc> information been read from OOXML file, the default value of center will be applied, so the problem occurred.
So does the Subtitle style.

The possible values of <w:jc> are:
both:  Justified
center: Align Center
left: Align Left
right: Align Right
distribute: Distribute All Characters Equally
highKashida: Widest Kashida Length
lowKashida: Low Kashida Length
mediumKashida: Medium Kashida Length
numTab: Align to list tab
thaiDistribute: Thai Language Justification
Comment 2 Yolanda Zhang Ying 2012-06-05 06:03:30 UTC
Created attachment 77979 [details]
code patch for default paragraph alignment

Code change to solve the problem for default paragraph styles alignment
Comment 3 Yolanda Zhang Ying 2012-06-05 06:34:30 UTC
Created attachment 77987 [details]
Patch for paragraph alignment issue
Comment 4 Yolanda Zhang Ying 2012-06-05 06:42:16 UTC
Created attachment 77988 [details]
Patch for paragraph alignment issue
Comment 5 Yolanda Zhang Ying 2012-06-05 06:47:37 UTC
Created attachment 77990 [details]
UT case been tested

The attachment include the UT case for this issues, and I mainly focus on the Paragraph style with Title and Subtitle, which I fixed in code.
Comment 6 Yolanda Zhang Ying 2012-06-05 06:51:36 UTC
Root cause:
The default paragraph alignment settings in OOXML is different from AOO's settings, if no property set in OOXML file for para align, it means align left been applied, which is center in AOO. 

Solution:
Before we import Title and Subtitle style, we put the para alignment with Left in, so we can keep the default value for these 2 paragraph styles.

UT:
Please refer to the UT samples in attachment.
Comment 7 Yan Ji 2012-06-07 02:29:36 UTC
reproduced issue
Comment 8 mayongl 2012-06-07 12:14:21 UTC
Review passed.
Comment 9 mayongl 2012-06-07 12:27:42 UTC
Reviewed, tested, and applied the patch.

SVN revision is 1347586.
Comment 10 binguo 2012-06-19 05:32:39 UTC
Verified it on Aoo_Trunk_20120616.1800.1350879 and it does not reproduce, so close it as fixed.
Comment 11 Shenfeng Liu 2012-10-09 08:53:45 UTC
set Target Milestone to AOO 3.5.0 for PM purpose.