Bug 154790 - Copy and paste alter all Heading paragraph styles throughout the remainder of the document
Summary: Copy and paste alter all Heading paragraph styles throughout the remainder of...
Status: NEEDINFO
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.5.1 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-13 15:33 UTC by Dale
Modified: 2024-05-09 04:46 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Document state after the paste from SSMS (14.72 KB, application/vnd.oasis.opendocument.text)
2023-04-14 19:41 UTC, Dale
Details
Document prior to the paste (13.86 KB, application/vnd.oasis.opendocument.text)
2023-04-14 19:41 UTC, Dale
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dale 2023-04-13 15:33:15 UTC
Steps to reproduce the problem:

1) Create or open an ODT Writer document that already has some Heading paragraph  styles used in the document.
E.g.:
Heading 1 (apply the Heading 1 paragraph style)
text
Heading 2 (apply the Heading 2 paragraph style)
text

2) Copy some code from a SQLQuery window in SQL Server Management Studio (SSMS) version 19.0.1.

3) Paste into the ODT Writer document. Not only does the new text come in formatted, but this action also changes the appearance of the Headings that previously existed in the document; the Headings throughout the entire document are all now indented. Using Edit>Undo does remove the pasted text, but does not undo the changes to the various Heading paragraph styles.
Editing the paragraph style does not reveal why the headings are now all indented; the Indents & Spacing tab in the "Paragraph Style: Heading 1" dialog shows 0.00 cm for the Indent > Before text and Indent > First line settings.

I understand that normal paste copies in the formatting, so that the pasted text preserves tables, colours, etc. But changing the existing paragraph styles in the destination ODT so that the entire remainder of the document is changed is not desirable behaviour; in particular having all Headings indented is an obvious and ugly change to automatically impose.

I want an option that allows me to copy in formatted text, preserving the incoming colours, fonts, bullets and numbered lists, without allowing the paste to mess up the existing paragraph styles used in the remainder of the document that existed before the paste. 
Microsoft Word has a paste option to merge foramtting with the styles that already exist in the document; so if the incoming text uses common paragraph styles like Heading 1, then the incoming text would use the existing style from the destination document and have its appearance changed to match the destination document.
Or maybe have an option to copy, but do not import or apply paragraph styles for the pasted text; instead just have the text set to be based on Default Paragraph Style but then apply bolding, colours and fonts as needed to preserve the look of the incoming text, but that pasted text will not use any defined paragraph styles.

Note that the Paste Special > Rich text formatting (RTF) option gives the same behaviour that alters the remainder of the document.
Comment 1 Dale 2023-04-14 19:41:36 UTC
Created attachment 186671 [details]
Document state after the paste from SSMS
Comment 2 Dale 2023-04-14 19:41:56 UTC
Created attachment 186672 [details]
Document prior to the paste
Comment 3 Dale 2023-04-14 19:42:32 UTC
See attachments for a sample of what happens when the user pastes from Sql Server Management Studio
Comment 5 Buovjaga 2023-04-19 14:44:54 UTC
You could use CopyQ to export the SSMS clipboard contents and attach it to this report, so others can test without installing SSMS.

https://github.com/hluk/CopyQ/releases
https://copyq.readthedocs.io/en/latest/backup.html#export-and-import
Comment 6 Dale 2023-04-30 23:26:37 UTC
I found an example that does not require any program other than Libre Office.
Copy the A1 cell from the "Sample file with bad source.ods" file, into the "Sample-before paste.odt" file. Prior to the paste the ODT heading paragraphs will not be indented; but the paste will mess that up.

Note that the ODS file was originally an XLSX document, so there may have been some extra formatting brought in from Microsoft. But the ODS file is now obviously a Libre Office file.

I don't see a place to attach the two files here, but I attached them to a comment at the following link in the 2023-04-30 comment: https://ask.libreoffice.org/t/stop-automatically-adding-a-tab-at-the-start-of-every-line-with-a-heading-style/90406
Comment 7 QA Administrators 2023-05-01 03:19:08 UTC Comment hidden (obsolete)
Comment 8 Dieter 2024-05-09 04:46:26 UTC
Dale, followinf discussion at ask.libreoffice your problem might be a duplicate of bug 151974, that has been resolved meanwhile. So could you please retest with actual version of LO? Thank you.
=> NEEDINFO