Download it now!
Bug 63023 - FILESAVE FILEOPEN Writer does not read correctly its own RTF files with headers and footers
Summary: FILESAVE FILEOPEN Writer does not read correctly its own RTF files with heade...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.1.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:4.1.0 target:4.0.4
Keywords:
: 54518 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-02 12:29 UTC by Milos Sramek
Modified: 2013-04-18 16:50 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
archive with the relevant files (638.15 KB, application/zip)
2013-04-02 12:29 UTC, Milos Sramek
Details
ODT file with header and footer (24.66 KB, application/vnd.oasis.opendocument.text)
2013-04-08 20:43 UTC, Milos Sramek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Milos Sramek 2013-04-02 12:29:04 UTC
Created attachment 77313 [details]
archive with the relevant files

Libreoffice cannot read correctly RTF files, containing headers and footers, written by itself. Verified in 3.6 and 4.0. Results of my testing are in the attached zip file.

The problem is that in header also the text from footer appears and in footer the text from header:see the file header-LO40.rtf.LO40.pdf

Apache OO 3.4 can correctly read its own similar rtf files and files produced by LO (see header-AO34.rtf.AO34.pdf)

LO40/LO36 cannot read AO34 files correctly: header-AO34.rtf.LO40.pdf

LO can read correctly similar rtf files produced by MSO 2013: header-MS13.rtf.LO40.pdf

Results of my testing are in the attached zip file. To reproduce:
1. in LO open the odt file
2. save as rtf and close LO
3. in LO open the rtf file

Names of the provided files mean: 

header-LO40.rtf
means: The document was stored by LO40 to an RTF file.
header-LO40.rtf.AO34.pdf
means: The document was stored by LO40 to an RTF file. Subsequently the RTF file was opened by AOO 3.4 and was saved to pdf.

--
Milos
Comment 1 Jorendc 2013-04-08 18:08:15 UTC
Hi,

Thanks for reporting.

The only bug I can reproduce is the background color is always set to 'black', but this is already reported in Bug 54518. Can you confirm this is the only issue? I see the subscript word have also a black background, but when you select it in the docx file and set the background color to 'no fill' this behavior is fixed.

Tested using Linux mint 14 x64 with LibreOffice 4.0.2.2 and LibreOffice Version: 4.1.0.0.alpha0+ Build ID: 7b515a57eb6a644860715018656ac0b843b62ba.

Can you confirm this is a duplicate of Bug 54518 then?

Kind regards,
Joren
Comment 2 Milos Sramek 2013-04-08 20:43:32 UTC
Created attachment 77632 [details]
ODT file with header and footer
Comment 3 Milos Sramek 2013-04-08 20:44:34 UTC
Comment on attachment 77632 [details]
ODT file with header and footer

Hi,

I installed 4.0.2.2 - the problem is still there. Not the 'black background' bug, but completely incorrect header and footer.

I've just noticed that I forgot to upload the odt file, one should start with (attached now). So, open the odt and count lines of the header and footer. Then store the file as rtf, close open the rtf and count the lines again. These are my numbers:
odf: Header 7 lines, footer 4 lines
rtf: Header 10 lines, footer 10 lines

Please, notice that LO can correctly read similar rtf files produced by MSO, but not by ApacheOO. ApacheOO, on the other hand, reads correctly the rtf files produced by LO (those, which it cannot correctly read). 

--
Milos
Comment 4 Jorendc 2013-04-08 20:56:30 UTC
Hi,

Thanks for your additional information.

(In reply to comment #3)
> I installed 4.0.2.2 - the problem is still there. Not the 'black background'
> bug, but completely incorrect header and footer.

Thanks for retesting. Can you reproduce this black background issue when you save the docx file (in your zipped package) as rtf? This is the document I tested with, and it export it well (only with that black background issue).

> odf: Header 7 lines, footer 4 lines
> rtf: Header 10 lines, footer 10 lines

Indeed, I can reproduce this behavior when I export your additional attached odt document.

Therefore this isn't a duplicate, but a NEW bug.

Kind regards,
Joren
Comment 5 Jorendc 2013-04-08 20:58:10 UTC
@Miklos: strange RTF bug. When exporting a docx file to rtf, it exports correctly (unless a bug, but that is already reported), when exporting the attached odt document to RTF, it has another behavior.

Kind regards,
Joren
Comment 6 Milos Sramek 2013-04-10 12:57:39 UTC
(In reply to comment #4)

> 
> Can you reproduce this black background issue when you
> save the docx file (in your zipped package) as rtf? This is the document I
> tested with, and it export it well (only with that black background issue).
> 
Yes, I can reproduce this. Reading docx and exporting and rereading rtf is even worse than exporting from odt: more text in the header has black background

best
Milos
> Joren
Comment 7 Miklos Vajna 2013-04-18 11:04:48 UTC
I can reproduce the black background problem in the header on the import side, I guess it'll be something about the substream doesn't get the color table or so. I'll look into this.
Comment 8 Milos Sramek 2013-04-18 11:23:58 UTC
(In reply to comment #7)
> I can reproduce the black background problem in the header on the import
> side, I guess it'll be something about the substream doesn't get the color
> table or so. I'll look into this.

Miklos, please notice that the black background was not the primary topic of my bug report. The primary problem is that in headers and footers are mixed together if reading rtf files. More in Comment 3. This bug is not present in ApacheOO.

thanks
Milos
Comment 9 Miklos Vajna 2013-04-18 12:36:24 UTC
Hi Milos,

In comment 1, Joren wrote:

> The only bug I can reproduce is the background color is always set to 'black'

This is why I attempted to fix that part. I would suggest creating a separate issue with an ODT reproducer document which has no formatted text in the header/footer about the header/footer problem; then surely the bug won't be closed with a related fix. :-)

(Feel free to use the See-Also field of the new issue to refer to this one if you want to connect them.)

Thanks for your understanding,

Miklos
Comment 10 Commit Notification 2013-04-18 13:59:15 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3d4fef85d05269e613316a7af6245f05d207d76e

fdo#63023 incorrect RTF background color in header



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 11 Milos Sramek 2013-04-18 14:55:07 UTC
(In reply to comment #10)
> Miklos Vajna committed a patch related to this issue.
> It has been pushed to "master":
> 
> http://cgit.freedesktop.org/libreoffice/core/commit/
> ?id=3d4fef85d05269e613316a7af6245f05d207d76e
> 
> fdo#63023 incorrect RTF background color in header
> 
Thank you, Miklos, for the patch.

Meanwhile, I did some experiments with he file, which initiated the bug report.

First, I removed the formatting, as you suggested. However, the text appeared in the footer again, but formatted!
Next, I deleted both the header and the footer in the original odt and saved it to rtf. Still they were there, just mutually exchanged. Only after deleting them in the rtf they vanished.

Then, I opened the file in MSO 2013, deleted the header and the footer and saved to rtf. When opening the rtf in LO40, the header and footer were gone. 

I do not know about the history of the file. I took it from the batch of test files provided by the Open Doc foundation at officeshots.org. 

--
Milos
Comment 12 Miklos Vajna 2013-04-18 15:14:02 UTC
Hi Milos,

I guess it's something about the improper handling of page styles, i.e. you edit one page style, and when the doc is saved/loaded, an other page style is used. As I asked, please let's have a dedicated bug for that problem.

In the meantime, the background color is submitted for review against -4-0: <https://gerrit.libreoffice.org/3461>, so I'm marking this bug as resolved.

Miklos
Comment 13 Commit Notification 2013-04-18 15:29:17 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cacdb29329cf6398df183b27b3dcb23d18d897d0&h=libreoffice-4-0

fdo#63023 incorrect RTF background color in header


It will be available in LibreOffice 4.0.4.

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 14 Milos Sramek 2013-04-18 16:34:13 UTC
(In reply to comment #12)
> Hi Milos,
> 
> I guess it's something about the improper handling of page styles, i.e. you
> edit one page style, and when the doc is saved/loaded, an other page style
> is used. As I asked, please let's have a dedicated bug for that problem.
OK, I'll do. Close then Bug 54518 too, its the same
Milos
> 
> In the meantime, the background color is submitted for review against -4-0:
> <https://gerrit.libreoffice.org/3461>, so I'm marking this bug as resolved.
> 
> Miklos
Comment 15 Jorendc 2013-04-18 16:50:33 UTC
*** Bug 54518 has been marked as a duplicate of this bug. ***