Issue 119464 - [From Symphony]text alignment changed from left to center when importing the docx
[From Symphony]text alignment changed from left to center when importing the ...
Status: CLOSED FIXED
Product: Writer
Classification: Application
Component: formatting
OOo 3.4 Beta
PC All
: P3 normal (vote)
: 4.0.0
Assigned To: mayongl
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-29 01:57 UTC by zongdj
Modified: 2012-10-09 08:53 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
sample file for this bug (31.80 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2012-05-29 01:57 UTC, zongdj
no flags Details
code patch for default paragraph alignment (61.11 KB, patch)
2012-06-05 06:03 UTC, Yolanda Zhang Ying
no flags Details | Diff
Patch for paragraph alignment issue (1.76 KB, patch)
2012-06-05 06:34 UTC, Yolanda Zhang Ying
no flags Details | Diff
Patch for paragraph alignment issue (1.47 KB, patch)
2012-06-05 06:42 UTC, Yolanda Zhang Ying
no flags Details | Diff
UT case been tested (56.05 KB, application/octet-stream)
2012-06-05 06:47 UTC, Yolanda Zhang Ying
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
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.