Bug 73221 - Last comment text is lost if you save as .docx without shifting the focus to another text area
Summary: Last comment text is lost if you save as .docx without shifting the focus to ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version: 3.5.0 release
Hardware: x86-64 (AMD64) All
: medium major
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-02 12:00 UTC by Peter Robinson
Modified: 2014-12-10 15:03 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Example of docx file that will not save last comment. (9.05 KB, application/wps-office.docx)
2014-01-02 22:44 UTC, Peter Robinson
Details
odt version of problem file that shows correct output (30.93 KB, application/vnd.oasis.opendocument.text)
2014-01-02 22:50 UTC, Peter Robinson
Details
test .docx with comments created in Win7 (4.99 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2014-01-02 23:12 UTC, tommy27
Details
.odt demonstrating correct function (10.71 KB, application/vnd.oasis.opendocument.text)
2014-11-20 18:33 UTC, Matt Price
Details
.docx shows auto-inserted annotation doesn't show up. (4.77 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2014-11-20 18:34 UTC, Matt Price
Details

Description Peter Robinson 2014-01-02 12:00:13 UTC
Document created and saved in docx format.  Comments inserted via menu item Insert/Comment.  Comments all appear correctly when typed and edited.  Document re-saved and then re-opened.  The last comment is blank.  The comment box appears but the text area is blank.  Tested on both Writer 4.1.1.? and 4.1.4.2.  Involves data loss so can be major problem, especially since the comments are usually written to be read by someone else sharing the document, who may not recognise the error.  Bug doesn't occur when saving in doc format.
Previous bug fix ID 33463 seems to be imperfect.
Comment 1 tommy27 2014-01-02 13:31:02 UTC
not reproducible in Win7 64bit with LibO 4.1.4.2

please try attaching an .odt with comments and the same file saved in .docx

edited summary notes.
Comment 2 Peter Robinson 2014-01-02 22:44:59 UTC
Created attachment 91441 [details]
Example of docx file that will not save last comment.

Further testing shows problem only arises for file originally created by someone else (in this case a student), presumably on a Windows machine.  When I try to add comments to this file on my Linux machine, the text of the last comment is lost.  If  I create a file from scratch on my own machine, no problems.
Comment 3 Peter Robinson 2014-01-02 22:50:52 UTC
Created attachment 91442 [details]
odt version of problem file that shows correct output

Student's file saved on my machine as odt document.  It shows correct output of comments.  Problems also found on other students' files, so not limited to one system.
Comment 4 tommy27 2014-01-02 23:07:40 UTC
(In reply to comment #2)
> Created attachment 91441 [details]
> Example of docx file that will not save last comment.
> 
> Further testing shows problem only arises for file originally created by
> someone else (in this case a student), presumably on a Windows machine. 

is this person using LibO 4.1.4.2 or another LibO release or MS Word?(In reply to comment #2)

> When I try to add comments to this file on my Linux machine, the text of the
> last comment is lost.  If  I create a file from scratch on my own machine,
> no problems.

these observations makes me think that the root of the bug is in the source .docx file.
Comment 5 tommy27 2014-01-02 23:12:04 UTC
Created attachment 91445 [details]
test .docx with comments created in Win7

try my file. it's a .docx with dummy text and 2 comments inside it.
it was created with LibO 4.1.4.2 under Win7 64bit.

can you add comments in your Linux machine? do you still experience issue?
Comment 6 Peter Robinson 2014-01-03 08:01:45 UTC
OK.  I think I've narrowed it down.  Different sources of files were a coincidence.  I think this replicates the behaviour for any docx file.
1. Create a file and save it as a docx file using any software.  If using LO and file includes comments, they will work correctly.
2. Close file and then re-open it in LO.
3. Insert comments.  When you write the last comment, without moving the cursor from the comment, click save button. (This is how you would interact when commenting someone else's document).
4.  The save button will grey out and disable, but in fact the last comment is not saved.  You can close the file (without getting any warning about saving) and re-open it and the last comment will be blank.
If in step 3, you move the cursor to the body of the document or to another comment before clicking save, the last comment will be saved correctly.  "ENTER-ing" comments seems to depend on shifting the focus to another text area, which may not happen naturally for the last comment.
The behaviour above is different from LO saving odt docs and MSWord saving docx files with comments added.
Comment 7 Peter Robinson 2014-01-03 08:05:12 UTC
Confirm error behaviour described occurs with your attachment 91445 [details].
Comment 8 tommy27 2014-01-03 08:37:38 UTC
> OK.  I think I've narrowed it down.  Different sources of files were a
> coincidence.  I think this replicates the behaviour for any docx file.
> ....
> "ENTER-ing" comments seems to depend on shifting the focus to another text
> area, which may not happen naturally for the last comment.
> ...


great!!! now I'm able to reproduce your bug on Windows!!! 
the key is to save without moving the cursor outside the comment window.

set status to NEW and platform to ALL.
Comment 9 tommy27 2014-01-03 11:40:46 UTC
reproduced issue with older releases up to 3.5.0 (tested with 3.4.3 too but it looses all comments after saving and reloading) with issue still present in 4.2.0.1rc

the bug is specific to .docx format and does not affect .odt and .doc

edited summary notes, changed version field and added Writer expert to CC list.
Comment 10 tommy27 2014-07-20 09:50:23 UTC
still reproducible with 4.2.5.2 and 4.4.0.0.alpha0+
Build ID: b9dca968c6fd0ab5ca140c65b0e54d153cd34986
TinderBox: Win-x86@42, Branch:master, Time: 2014-07-18_22:51:20
Comment 11 Matt Price 2014-11-20 04:08:24 UTC
I think I am experiencing this bug (lost a whole bunch of grading this week as a result!).  I have LO 4.3.3.2 from Arch Linux repos; some macro customization which I am reluctant to lose so haven't tried purging my install yet.  Please let me know if there's some work I can do to help debug.
Comment 12 Matt Price 2014-11-20 16:14:17 UTC
I am finding that the content of comments created with a macro are also not being saved to docx.  So it is not dependent just on the final state of the document -- it seems to have to do with whether the comment was ever manually exited.  

Here's the macro I'm using:  

sub createCommentwithCheckmark
    rem create the annotation object
	oAnno = ThisComponent.createInstance("com.sun.star.text.textfield.Annotation")
	rem Chr 10004 is the decimal for hex code 2714, "heavy checkmark"
	oAnno.Content = Chr(10004)
	oAnno.Author = "Matt Price"
	oText = ThisComponent.Text
	rem check to see if anything is selected
	oSels = ThisComponent.getCurrentSelection()

	If Not IsNull(oSels) Then 
	oVC = ThisComponent.CurrentController.ViewCursor
		oText.insertTextContent(oVC, oAnno, True)

	Else 
		oVC = ThisComponent.CurrentController.ViewCursor
		oText.insertTextContent(oVC.Start, oAnno, False)
	End If
end sub

I'm guessing that using "insertTextContent" is the only line that really matters here
Comment 13 Matt Price 2014-11-20 18:33:28 UTC
Created attachment 109769 [details]
.odt demonstrating correct function

.odt file saves attachments properly, even if cursor remains in final annotation, and even though first annotation was input via macro with no manual intervention.
Comment 14 Matt Price 2014-11-20 18:34:28 UTC
Created attachment 109770 [details]
.docx shows auto-inserted annotation doesn't show up.

Shows auto-inserted annotation is not saved to .docx, despite being saved to .odt.
Comment 15 Matt Price 2014-12-10 02:14:42 UTC
Since this bug appears to persist in recent builds would it be permissible to change the version to 4.3.2 or similar?
Comment 16 tommy27 2014-12-10 04:38:13 UTC
no, this is not how the version field should be edited.

try to change it to a later version and you will see this message:

"You are changing the version of the bug to a later version. As the version field of the bug should show the earliest version manifesting the bug, please reconsider, if you really want to do this. Please do not change a version, because it also manifests in a later version. for details, please see the guidelines"
Comment 17 Matt Price 2014-12-10 15:03:29 UTC
thanks for the clarification, Tommy.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.