Bug 102627 - Paste Special of RTF formatted text from Writer table can change the font in Calc
Summary: Paste Special of RTF formatted text from Writer table can change the font in ...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: x86 (IA32) Windows (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: RTF-Paste
  Show dependency treegraph
 
Reported: 2016-09-27 14:28 UTC by David F Smith
Modified: 2021-04-19 18:44 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Writer document containing a table with various font effects, all in Times New Roman. (10.98 KB, application/vnd.oasis.opendocument.text)
2016-09-27 14:28 UTC, David F Smith
Details
Calc spreadsheet showing the result of the bug: cells containing more than one font effect are partly in Liberation Sans font. (13.16 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-09-27 14:29 UTC, David F Smith
Details
Calc spreadsheet showing the result, as of 15-Apr-2021 (worse results than originally) (14.06 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-04-15 14:35 UTC, David F Smith
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David F Smith 2016-09-27 14:28:02 UTC
Created attachment 127675 [details]
Writer document containing a table with various font effects, all in Times New Roman.

1. In a blank LibreOffice Writer document, create a table.
2. Select all rows and columns of the table, then set the Paragraph Style to Default Style and the Font Name to Times New Roman.
3. Enter text in the table cells.  Some text must contain both normal and italics, bold, subscript, or other special effects.  (The attached file is an example.)
4. Select all rows and columns of the table, then copy (Ctrl+C or Edit > Copy).
5. Create a new LibreOffice spreadsheet.  Select cell A1, then choose Edit > Paste Special (or Ctrl+Shift+V). From the Paste Special box, choose Formatted Text [RTF] and click OK.
6. Examine the imported cells.  Any cell with a single text type (for example, normal text, or italics, or bold) will appear in Times New Roman.  In any cell with two text types (for example, normal and italics), the normal text will be in the default spreadsheet font (Liberation Sans, in my copy), and the "special" characters will be in Times New Roman.  (It's easy to distinguish the two by the absence or presence of serifs on the letters.)

I think that this is a problem in the way Calc pastes formatted (RTF) material rather than the way Writer stores it, because I see the same issue when I use Microsoft Word in steps 1-4.

Variations:
In step 2, if the Paragraph Style for the table is set to (or left at) Table Contents, then the import in step 6 is correct, with all cells in Times New Roman.  There's something significant about Default Style.
In step 2, the Font Name can be set to any font, and the result is the same: on import, the cells with only one font effect, or the "special" effect in cells with two effects, are in the selected font, and the remainder of the text is in Liberation Sans.
If a cell in the Writer table has three different text types (normal and italics and bold), the normal text appears in Calc in Liberation Sans font and the others are in Times New Roman.
I haven't figured out how to change the default font of a spreadsheet to something other than Liberation Sans.  That might be an interesting experiment.
Comment 1 David F Smith 2016-09-27 14:29:38 UTC
Created attachment 127676 [details]
Calc spreadsheet showing the result of the bug: cells containing more than one font effect are partly in Liberation Sans font.
Comment 2 Buovjaga 2016-10-12 11:46:25 UTC
Repro.

This is kind of expected as it is risky to mix styles with direct formatting.

(In reply to David F Smith from comment #0)
> I haven't figured out how to change the default font of a spreadsheet to
> something other than Liberation Sans.  That might be an interesting
> experiment.

Go to Styles and formatting in the sidebar, right-click Default (in Cell styles view), Modify, go to Font tab and change away.

Win 7 Pro 64-bit Version: 5.3.0.0.alpha0+
Build ID: e2f6c7f0d0cc14f851d7028ff846c5dc658a81c6
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2016-10-10_23:08:02
Locale: fi-FI (fi_FI); Calc: group

LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735
Comment 3 QA Administrators 2017-10-23 14:02:36 UTC Comment hidden (obsolete)
Comment 4 David F Smith 2017-10-23 18:18:03 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2018-10-24 02:57:46 UTC Comment hidden (obsolete)
Comment 6 David F Smith 2018-11-23 16:19:53 UTC
This bug is still present, with exactly the same symptoms as in the original report.

Version: 6.0.5.2 (x64)
Build ID: 54c8cbb85f300ac59db32fe8a675ff7683cd5a16
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: en-US (en_US); Calc: group
Comment 7 QA Administrators 2021-04-15 03:43:00 UTC Comment hidden (obsolete)
Comment 8 David F Smith 2021-04-15 14:35:07 UTC
Created attachment 171222 [details]
Calc spreadsheet showing the result, as of 15-Apr-2021 (worse results than originally)

See in particular row 2, in which the italics and bold effects were not copied.  These cells, which contained text in one single format (not two formats, as in later rows) lost that formatting.
Comment 9 David F Smith 2021-04-15 14:36:41 UTC
The behavior is now WORSE than it was before.

In my original report, the cells in row 2 of the spreadsheet copy were in italics (col A) and bold (col B), but now both cells are in normal Times New Roman, losing the special effects.  The behavior in the remaining cells is similar: text with an effect (bold, italics, or bold italics) appears in the copy as normal Times New Roman, losing the effect, while the rest of the text in the cell becomes Liberation Sans font.  The exception is the last two rows, in which, as reported originally, the underlined, subscript, and superscript text is correct.

In summary, even in cells containing text all of which has a single font effect (bold, italics, or bold italics), that effect is lost in the Paste Special.

I have attached a new spreadsheet showing this behavior.

I don't know if this change has something to do with the change in Paste Special options.  Originally there was an option "Formatted Text [RTF]", but now that option is gone and there's one called "Rich text formatting (RTF)".

Version: 7.0.5.2 (x64)
Build ID: 64390860c6cd0aca4beafafcfd84613dd9dfb63a
CPU threads: 4; OS: Windows 10.0 Build 19041; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded
Comment 10 Buovjaga 2021-04-18 13:13:28 UTC
(In reply to David F Smith from comment #8)
> Created attachment 171222 [details]
> Calc spreadsheet showing the result, as of 15-Apr-2021 (worse results than
> originally)
> 
> See in particular row 2, in which the italics and bold effects were not
> copied.  These cells, which contained text in one single format (not two
> formats, as in later rows) lost that formatting.

I don't reproduce this worsening.

Arch Linux 64-bit
Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: 5348b3946b8f2b9581cdd8b40fa774c2a9d23868
CPU threads: 8; OS: Linux 5.11; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 16 April 2021
Comment 11 David F Smith 2021-04-19 18:44:47 UTC
Buovjaga's Comment 10 prompted me to try again.  Starting from my original text document, I got the same (worse) results that I reported on 15-Apr.  But when I recreated the table from scratch in a new text document, then copied and pasted that into Calc, the formatting was copied (mostly) correctly.  ("Mostly" means that the bold text turned into a super-wide bold format.  I don't understand that.)
So my original bug is now pretty much fixed, and my updated report from 15-Apr seems to be due to sometime weird in my text document.  I'm changing the status to WORKSFORME.
Thanks.