Bug 69649 - FILEOPEN: Import DOCX renders page numbers wrong in Table-of-Contents
Summary: FILEOPEN: Import DOCX renders page numbers wrong in Table-of-Contents
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Vinaya Mandke
URL:
Whiteboard: BSA target:4.3.0 target:4.2.6
Keywords:
: 72585 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-09-21 16:24 UTC by Adam CloudOn
Modified: 2019-04-15 04:05 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
DOCX containing a Table-of-Contents (34.23 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-09-21 16:24 UTC, Adam CloudOn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam CloudOn 2013-09-21 16:24:41 UTC
Created attachment 86266 [details]
DOCX containing a Table-of-Contents

Problem description: 
When LO opens the attached DOCX - it renders the Table-of-Contents pages wrong (e.g. - look at the last entry in the ToC - it says page '16' instead of page '15').

Steps to reproduce:
1. Load the attached DOCX in LO
2. The page numbers are rendered incorrectly
3. ....

Current behavior:
LO renders some of the page numbers in the ToC incorrectly

Expected behavior:
LO should render all the page numbers in the ToC like MS Word
              
Operating System: All
Version: 4.2.0.0.alpha0+ Master
Comment 1 Thomas van der Meulen [retired] 2013-09-29 07:05:35 UTC
It looks like you reported the bug twice.

*** This bug has been marked as a duplicate of bug 69655 ***
Comment 2 Adam CloudOn 2013-10-02 16:19:34 UTC
(In reply to comment #1)
> It looks like you reported the bug twice.
> 
> *** This bug has been marked as a duplicate of bug 69655 ***

Thomas. This is not a duplicate.
Bug 69655 talks about the level of the Table-of-Contents, meaning - in the original file you have in the ToC - 'Heading 1', 'Heading 1.1' etc.. and in the exported file you only have the first level ('Heading 1', 'Heading 2', etc..)

Bug 69649 talks about the actual page numbers in the ToC that are being imported wrong.
In the original file the page number of the last entry is page #15, and in the file imported by LO - the page number of the last page is page #16.

So these are 2 different import bugs (that both relate to Table-of-Contents).
Comment 3 Vinaya Mandke 2013-12-23 08:48:57 UTC
*** Bug 72585 has been marked as a duplicate of this bug. ***
Comment 4 Jorendc 2014-01-02 16:47:17 UTC
@Vinaya, Adam: please have a look to http://cgit.freedesktop.org/libreoffice/core/commit/?id=f65568118fc1ac71c22a3084e0a1bdd315a91006

It's cherry-picked from Apache OpenOffice. The commit-title looks very related to this bug, so you might consider have a look :-).

Related AOO bug: https://issues.apache.org/ooo/show_bug.cgi?id=119568

Kind regards,
Joren
Comment 5 Commit Notification 2014-01-03 08:38:38 UTC
Vinaya Mandke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=9679e9c23216decb5f9f25f85b04cb3f25211111

fdo#69649 Fix for pre-rendered Table Of Contents



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 6 Vinaya Mandke 2014-01-03 10:02:03 UTC
@Jorendc, Adam
This patch imports the TOC entries from the file itself. This also fixes
bug 69655.
Comment 7 Jorendc 2014-01-03 12:30:25 UTC
(In reply to comment #5)
> Vinaya Mandke committed a patch related to this issue.
(In reply to comment #6)
> @Jorendc, Adam
> This patch imports the TOC entries from the file itself. This also fixes
> bug 69655.

I can confirm this patch fixed this issue. Tested using Linux Mint 16 x64 with LibreOffice Version: 4.3.0.0.alpha0+ Build ID: 308fdfb1a9176f65c11d82b95e3aa73b87e2fe47 (which do include this patch).

Thanks for your work :)!

PS: can we backport this to 4.2-branch as well?

Kind regards,
Joren
Comment 8 Vinaya Mandke 2014-01-22 07:26:51 UTC
@Joren, 

Sorry for the late reply. I think it might be possible. Though I have not checked building these changes on 4.2. Is there a way to check the same without building the 4.2 branch at my end ?

Regards,
Vinaya
Comment 9 Jorendc 2014-01-22 17:46:20 UTC
(In reply to comment #8)
> Is there a way to check the same
> without building the 4.2 branch at my end ?

Not sure about that. I guess you only can do that by building yourself, but it might be interesting to ask that on IRC to developers :-).

Kind regards,
Joren
Comment 10 Commit Notification 2014-01-23 16:41:42 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=018bbe6c538d99c2f14fd4c761048848dc458f4a

fdo#69649 RTF import: don't crash on empty TOC result



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 Commit Notification 2014-07-01 15:03:52 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-4-2":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=64a72ee3e0e5818cd36e96f67ca7543e8a366969&h=libreoffice-4-2

fdo#69649 RTF import: don't crash on empty TOC result


It will be available in LibreOffice 4.2.6.

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 12 Serge Krot (CIB) 2017-10-20 09:48:45 UTC
Unit test DECLARE_OOXMLEXPORT_TEST(testFdo69649, "fdo69649.docx") was enhanced in order to remove usage of magic number.

http://cgit.freedesktop.org/libreoffice/core/commit/?id=143c482b3189cb084fbdf5e6f78f15b43f099e24