Bug 128106 - creating master document from *.odt breaks cross-references
Summary: creating master document from *.odt breaks cross-references
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Michael Stahl (allotropia)
URL:
Whiteboard: target:7.3.0 target:7.2.2
Keywords:
Depends on:
Blocks: Writer-Master-Doc Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2019-10-12 12:51 UTC by Oliver Brinzing
Modified: 2021-11-11 14:38 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
cross reference demo (9.84 KB, application/vnd.oasis.opendocument.text)
2019-10-12 12:51 UTC, Oliver Brinzing
Details
cross reference demo with bookmarks (11.64 KB, application/vnd.oasis.opendocument.text)
2019-10-13 06:58 UTC, Oliver Brinzing
Details
global document with repaired bookmarks (28.93 KB, application/x-zip-compressed)
2019-10-13 07:19 UTC, Oliver Brinzing
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Brinzing 2019-10-12 12:51:58 UTC
Created attachment 154954 [details]
cross reference demo

steps to reproduce:

- open attached writer document, it contains chapter numbering and some cross 
  references, inserted via Menu Insert/Cross-reference/Headings

- Menu File/Send/Create Master Document 

- after update links, references are broken, showing: 
  Error: Reference source not found
Comment 1 Roman Kuznetsov 2019-10-12 20:49:38 UTC
When you create master document from your file you get master and two different ODT files splitted by Heading 1 style paragraph.
Now you have TWO files and Writer can't work with cross-reference between different files. It works only inside one file.

There is a workaround for it. You can use bookmarks in every ODT with unique names and then you'll paste bookmarks using fields->cross-reference->bookmarks in need ODT. In ODT you'll see some error, but when you'll open your master document its will be works fine.

May be it's a bug, but now it works that way...

Possible better will create an enhancement about cros-references between different files
Comment 2 Oliver Brinzing 2019-10-13 06:58:27 UTC
Created attachment 154965 [details]
cross reference demo with bookmarks

Added a second example with additionally two standard bookmarks/references:

- bookmark "bookmarkchapter1" has a reference from Chapter 2
- bookmark "bookmarkchapter1_text" has a reference from inside Chapter 1

But during master document export *all* xml <bookmark-start/><bookmark-end/> elements will be removed.

IMHO it could work, if the <bookmark-start/> <bookmark-end/> elements would not be removed during export. Maybe the unique "__RefHeading__4_2121972034" names need to be renamed before too.
Comment 3 Oliver Brinzing 2019-10-13 07:19:39 UTC
Created attachment 154966 [details]
global document with repaired bookmarks

added an attachment with manual repaired bookmarks in "global1.odt":

- bookmark "bookmarkchapter1_text"
- bookmark "Chapter 1.1" (Chapter 1.1)

cross references from "global2.odt" will now work
Comment 4 Dieter 2019-10-27 16:39:01 UTC
(In reply to Oliver Brinzing from comment #0)
> Created attachment 154954 [details]
> cross reference demo
> 
> steps to reproduce:
> 
> - open attached writer document, it contains chapter numbering and some
> cross 
>   references, inserted via Menu Insert/Cross-reference/Headings
> 
> - Menu File/Send/Create Master Document 
> 
> - after update links, references are broken, showing: 
>   Error: Reference source not found

I confirm it with

Version: 6.4.0.0.alpha1 (x64)
Build ID: cc57df8f942f239d29cb575ea5a7cb01405db787
CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: GL; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded

I set status to NEW, because I think this shouldn't happen or there should be at least a warning.
Comment 5 Commit Notification 2021-08-27 15:10:29 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3608de9a3647294361c64b923b1ae413ad9755df

tdf#128106 sw: copy bookmarks in SwDoc::SplitDoc()

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2021-08-27 15:10:41 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4bf04dea9afb30a9395e80b07a81d1908937ee8b

tdf#128106 sw: copy bookmarks at start if whole node is copied

It will be available in 7.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Michael Stahl (allotropia) 2021-08-27 15:12:02 UTC
fixed on master
Comment 8 Commit Notification 2021-08-31 09:10:03 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/7094f05e0e4b5c62ee7c1d42eed15e9cc3aff103

tdf#128106 sw: copy bookmarks in SwDoc::SplitDoc()

It will be available in 7.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2021-08-31 09:10:14 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-7-2":

https://git.libreoffice.org/core/commit/8885bdf2f564bb7b56181c50baf39ff99d551ec9

tdf#128106 sw: copy bookmarks at start if whole node is copied

It will be available in 7.2.2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Buovjaga 2021-09-08 10:13:50 UTC
Both demo files now work

Arch Linux 64-bit
Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 9b73d3e8926d5f9b10464d19b539eef3eb088f50
CPU threads: 8; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 8 September 2021