Issue 96263

Summary: The "anchor" setting of an inserted picture will be modified after saving as .doc files.
Product: Writer Reporter: charleschen <charles0311>
Component: codeAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Normal    
Priority: P3 CC: cno, elish, gkamani2011, issues, nem2564, petko, qa.software.tester.anielsen+ast, rainerbielefeld_ooo_qa
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: PC   
OS: Linux, all   
Issue Type: DEFECT Latest Confirmation in: 4.1.0-dev
Developer Difficulty: ---
Attachments:
Description Flags
Word 2010 file as requested
none
screenshot of document
none
Image distorted in 95 / 6.0 .doc format none

Description charleschen 2008-11-17 02:30:23 UTC
When select "To Page" or "To Paragraph" in the "anchor" setting of an inserted
picture and save the document as .doc (Microsoft Word 97/2000/XP) file, the
setting will become "To Character".

Steps to reproduce:
1. Create a new text document in Openoffice.org Writer.
2. Select "Insert" from the menu bar.
3. Move mouse to "Picture" and then select "From File" from the pop-up menu.
4. Insert a picture.
5. Right click the inserted picture.
6. Move mouse to "Anchor" and then select "To Page" or "To Paragraph" from the
pop-up menu.
7. Save this document as .doc (Microsoft Word 97/2000/XP) file.
8. Close this document.
9. Open the saved document, and the "anchor" setting of the inserted picture
will become "To Character".
Comment 1 cno 2009-04-07 11:41:55 UTC
Hi charles

I see the same behaviour on WinXP.
I think however, that the problem is on Words side - I have no idea how to
influence anchoring position in that programm. See for example this
http://www.markrepp.com/2008/05/how-to-anchor-text-boxes-pictures-and.html

Do you know it?
thanks - cor
Comment 2 Edwin Sharp 2013-12-28 19:02:33 UTC
As given in description.
AOO410m1(Build:9750)  -  Rev. 1551264
2013-12-17_04:10:52 - Rev. 1551455
Debian
Comment 3 Rainer Bielefeld 2014-03-08 10:42:02 UTC
Back to UNCONFRIRMED due to Comment 1

Version has been changed wrongly from OOo 3.0 to 4.1.0-dev, so back!

Would be interesting to know
(a) .doc support anchors to page and paragraph?
(b) if yes, is this a fileopen or filesave problem?
(c) but I am really sure that we have a problem here, but some more 
    research will be required. Example: 
    Attachment 81153 [details] for Bug 122846 possible demonstrates such an anchor problem.
    I will do further tests when I have access to MS WORD
	
@Edwin:
If I remember correctly you have access to MSO? Can you create a .doc with 2 pictures anchored to paragraph and to PAge and attach it here for more tests?
Comment 4 Edwin Sharp 2014-03-21 09:16:44 UTC
Created attachment 82935 [details]
Word 2010 file as requested
Comment 5 Edwin Sharp 2014-03-21 09:30:45 UTC
Created attachment 82937 [details]
screenshot of document
Comment 6 Rainer Bielefeld 2014-04-01 21:01:50 UTC
Hm, the report is concerning .doc, but sample document is .docx. 

I'm afraid I was not precise enough in my Comment 3. My idea  was ot try to create a .doc with WORD proving that concept "Anchor at Paragraph" and "Anchor at Page" are known in .doc format.

I did some tests with documents created with AOO and saved from WORD2010. Same contents as .odt keeps all 4 different anchors, .doc looses "at Paragraph" and "at PAge" when reopened ny AOO.

But .doc closed from WORD, reopened and saved as .odt shows correct anchors, so the problem might be a AOO open-import problem.

More tests necessary
Comment 7 Rainer Bielefeld 2014-04-10 04:47:34 UTC
I did some tests and they seem to show that it is possible to have clear association between AOO anchors and .doc anchors (what have a completely different concept). Sample documents with explications coming soon.
Comment 8 Gaurav Kamani 2014-09-22 21:45:33 UTC
To test this bug, I replicated the steps provided by 'charleschen'. The process was performed on two systems: one running Windows 8. Pro, and another one running Mac OS X 10.9.5.
Both of these systems were running Apache OpenOffice 4.1.1 (AOO411m6(Build:9775)-Rev. 1617669)

The steps are: 

1. Create a new text document in Apache OpenOffice Writer.
2. Select "Insert" from the menu bar.
3. Move mouse to "Picture" and then select "From File" from the pop-up menu.
4. Insert a picture.
5. Right click the inserted picture.
6. Move mouse to "Anchor" (that is a part of the list) and then select "To Page" or "To Paragraph" from the
pop-up menu.
7. Save this document as .doc (Microsoft Word 97/2000/XP) file.
8. Close this document.
9. Open the saved document, and again right click the picture and select "anchor" option and we will observe that the setting has been changed to -> "To Character".

I was quite intrigued by this and therefore I also tried it on a MAC computer. After this I repeated the process and set the anchors (initially) to 'To Character' and to 'As Character'. And both of these anchor values remained as it is after reopening the document. 

So, I was successfully able to replicate this bug.
Comment 9 Gaurav Kamani 2014-09-22 21:51:24 UTC
Also, I would like to add this for future people who will review this bug. Initially when I read through this report, I had no idea what anchoring was or what was it did. So, a brief google search helped me with that. I would like to pass on that information to future users:

Anchoring is when a picture is positioned with reference to something. It can be with reference to a text, paragraph, or character.

Source: http://office.microsoft.com/en-us/word-help/add-graphics-and-keep-them-where-you-want-them-RZ001026465.aspx?section=27

Source2: https://wiki.openoffice.org/wiki/Documentation/OOo3_User_Guides/Writer_Guide/Arranging_anchoring_aligning
Comment 10 Gaurav Kamani 2014-09-22 22:06:11 UTC
I forgot to add that I tried to replicate the bug with 'Microsoft Word 95 (.doc)" and I failed. Similar anchoring issue does not occur when using that format.
Comment 11 Nirmal 2014-10-11 21:48:39 UTC
I followed the steps given by charleschen and replicated the bug. I would like to add few comments about this bug.

1) The same bug can be seen in Windows 7 Ultimaate, Xp, Mac OSx and RadHat linux.
2) Also anchor changes from 'To page' to 'To character' for .doc (word 97/ 2000/ Xp, word 2010, word 6.0, word 95)
Comment 12 Andreas 2019-05-09 15:23:50 UTC
(Andreas Nielsen, May 9 2019)
Apache OpenOffice 4.5.0 (AOO450m1(Build:9900) - Rev. 1858450)

HP ZBook 17 G2
Windows 10 Pro, Version 1803
Processor: Intel (R) Core (TM) i7-4810MQ CPU @ 2.80GHz
Ram: 24.00 GB, 64-Bit Operating System

I was able to reproduce this issue using OO 4.5.0, but noticed some slight differences in behavior between the .doc versions.

Also, the default anchor setting appears to be 'To Paragraph'.

I followed charleschen's steps, and summarize at a high level:

## TEST 1
1. Created a new, blank document in OO Writer.
2. Inserted PNG.
3. Changed anchor from 'To Paragraph' to 'To Page'.
4. Saved as .doc (95/2000/XP).
5. Was prompted by OO that the document may contain formatting or content that cannot be saved in the 95/2000/XP file format. (I selected 'Keep Current Format').
6. After closing, and reopening the file in OO Writer, the anchor setting had in fact changed to 'To Character'.

## TEST 2 (I only modified step 4, but behavior changes)
1. Created a new, blank document in OO Writer.
2. Inserted PNG.
3. Changed anchor from 'To Paragraph' to 'To Page'.
4. Saved as .doc (95).
5. Was prompted by OO that the document may contain formatting or content that cannot be saved in the 95 file format. ('Keep Current Format').
6. After closing, and reopening the file in OO Writer, the anchor setting had changed from 'To Page' to 'To Paragraph' (not 'To Character').

## TEST 3 (I only modified step 4, but behavior same as TEST 2)
1. Created a new, blank document in OO Writer.
2. Inserted PNG.
3. Changed anchor from 'To Paragraph' to 'To Page'.
4. Saved as .doc (6.0).
5. Was prompted by OO that the document may contain formatting or content that cannot be saved in the 6.0 file format. ('Keep Current Format').
6. After closing, and reopening the file in OO Writer, the anchor setting had changed from 'To Page' to 'To Paragraph' (not 'To Character').

I repeated all the aforementioned steps with a JPG file as well, and the behavior was the same as with the PNG.

I did try the same steps, and saving it to a .docx file. After closing, and reopening the file, the anchor setting had not changed. It was set to 'To Page' before saving, and when reopened the anchor setting was still 'To Page'.

I see that Nirmal had a different experience. For him/her 'To Page' changed to 'To Character' with all three .doc options, whereas for me in 4.5.0, 97/2000/XP was the only one that changed to 'To Character'. The other two (95, 6.0) also changed, but to 'To Paragraph', not 'To Character'.

...

One thing I noticed with both 95 and 6.0 was that the image would get distorted or stretched, whereas with 97/2000/XP the shape would remain untouched.

I have attached an image that compares the files after reopening. 95 (6.0 same behavior) on the left, 97/2000/XP on the right. You can see that the inserted image differs between the two.
Comment 13 Andreas 2019-05-09 15:26:36 UTC
Created attachment 86677 [details]
Image distorted in 95 / 6.0 .doc format

This image shows the same image inserted and saved in two different .doc formats. The left one is 95 (6.0 behaves the same way), and the right one is 97/2000/XP.
Comment 14 Peter 2019-05-12 07:12:33 UTC
Lets set it on confimed based on the report in comment 12, since the test confirms only within OO.