Bug 132289 - Inserted file not displayed correctly (Numbering missing)
Summary: Inserted file not displayed correctly (Numbering missing)
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: Serge Krot (CIB)
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks: Insert-File-Content
  Show dependency treegraph
 
Reported: 2020-04-21 06:40 UTC by Samuel Mehrbrodt (allotropia)
Modified: 2020-12-02 07:49 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
insert_this.odt (7.37 KB, application/vnd.oasis.opendocument.text)
2020-04-21 06:40 UTC, Samuel Mehrbrodt (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Samuel Mehrbrodt (allotropia) 2020-04-21 06:40:28 UTC
Created attachment 159774 [details]
insert_this.odt

1. Open an empty document in Writer
2. Press bold button
3. Insert file insert_this.odt

Expected:
 The inserted file is displayed with full numbering

Actual:
 In the first line the numbering is missing.

The problem is, that the paragraph style from the imported text is not applied.

My proposal to prevent this type of issues would be (similiar to what Word does):

* Always use the paragraph style from the inserted file (this would fix the numbering issue)
* Never expand direct formatting to inserted text, but keep it on the existing text
* Same for character styles, never expand them

This makes sure that the inserted file is displayed as good as it can be.
Comment 1 Dieter 2020-04-22 11:07:07 UTC
I confirm it with

ersion: 7.0.0.0.alpha0+ (x64)Build ID: 8c8b3a4f83f67882b284ddc3b3fe10d3fe6dedf4CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; Locale: de-DE (de_DE); UI-Language: en-GBCalc: CL

Step 3: Insert => Text from File => insert_this.odt
Comment 2 Heiko Tietze 2020-04-24 08:59:42 UTC
Always a tricky question what format to keep. We had a discussion recently how to handle copied text pasted to footnotes (bug 100018). General rule: if the target is empty take the formatting from the source, if the target has at least one character keep the formatting (see also bug 98381).

I would expect that bold on no character has no effect on the format and your list is inserted with numbering whether using Insert > Text from File or via copy/paste. But as you report the numbering is missing on the first line - and the line is formatted bold.

*List Item One*
2. List Item Two
3. List Item Three

In case of copy/paste all numbers are taken but the last line becomes bold

1. List Item One
2. List Item Two
*3. List Item Three*

If the target document has at least one character, a space in bold and cursor after this character, it looks like this:

Insert > Text from File
List Item One (yes, no bold)
2. List Item Two
3. List Item Three

Copy/paste
* List Item One*
2. List Item Two
*List Item Three*

Same test with cursor in front of the bold space:

Insert > Text from File:
*List Item One*
1. List Item Two
List Item Three

Copy/paste:
1. List Item One
2. List Item Two
*List Item Three*
Comment 3 Cor Nouws 2020-04-29 18:34:16 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #0)

> This makes sure that the inserted file is displayed as good as it can be.
IMO this is a corner case, compared to the solid behavior we all know since 1993 or so ;)
So - how much I appreciate to serve people that know Word - I would have many sleepless nights if the choice would be to go with this proposal.
Wouldn't it be possible to just check the pasted stuff and respect the lists ?
Comment 4 Heiko Tietze 2020-04-30 08:44:29 UTC
We discussed the topic in the design meeting. A stringent method what formatting is taken makes sense and, as outlined in comment 2, inserting content from a file or copy/pasting on an empty paragraph should take the formatting from the source.

If the operation is applied somewhere in the middle of the paragraph we keep the target style, which also applies to lists. Otherwise you get

Source: 1. First item \n 2. Second item
Target: Lorem ipsum |dolor est (pasting at the pipe)

Result with list style applied:
1. Lorem ipsum First item
2. Second item
3. dolor est

Result w/o list style:
Lorem ipsum First item
1. Second item
dolor est
(this is the expected behavior)
Comment 5 Commit Notification 2020-10-10 11:41:40 UTC
Serge Krot committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3f425069fc31bd6bac86d98312631321d0ff591f

tdf#132289 missing styles when inserting file with list

It will be available in 7.1.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 Dieter 2020-12-02 07:49:46 UTC
Verified with

Version: 7.1.0.0.alpha1+ (x64)
Build ID: 10b23330a9655658e6d7ef1d008a3302a15e9629
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: threaded

Serge, thanks for fixing it!