Bug 149661 - [Feature request] Automatic table-background-coloring ported from Calc to Writer.
Summary: [Feature request] Automatic table-background-coloring ported from Calc to Wri...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.0.3.1 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: Writer-Tables
  Show dependency treegraph
 
Reported: 2022-06-21 15:14 UTC by Sion
Modified: 2022-06-22 14:38 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Screenshots showing the problem (101.52 KB, image/png)
2022-06-21 16:56 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sion 2022-06-21 15:14:32 UTC
Description:
In Libre Office Calc, there is: 
Format > Conditional > (Condition, Color Scale, ...)

But his option is "missing" from Libre Office Writer. 
Even though you have inserted a table, populated it with suitable numbers & selected a suitable row of numbers.

I would REALLY like to see this feature be copied over to Libre Writer too.

Steps to Reproduce:
In Libre Office CALC only.

* Make a column of different numbers (eg. 1, 2, 3, ...).
* Select that column.
* Go to: Format > Conditional > Color Scale.
* Press Ok (use default values)

Actual Results:
Now the numbers in that column each has a custom background color (default ranging from: (smallest) Red to Green (largest number)) depending on their value, no matter the order of the numbers.

Expected Results:
I want this function to also exist in Libre Office WRITER too.


Reproducible: Always


User Profile Reset: No



Additional Info:
It would be very useful to me right about now.

Thank you!
Comment 1 Sion 2022-06-21 15:24:59 UTC
Optionally (or additionally?)

It would be useful to be able to (special-)copy the values AND background from Libre Calc & paste it into a Libre Writer Table, so the background colors are preserved too.
Comment 2 Rafael Lima 2022-06-21 16:56:47 UTC
Created attachment 180880 [details]
Screenshots showing the problem

Confirmed with

Version: 7.3.3.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 12; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.3-0ubuntu0.22.04.1
Calc: threaded

I would say that all formatting applied in Calc should be pasted into Writer.

See in the attached image a Calc table in the left and how it gets pasted into Writer (in the right side).

Note that only the bold format gets pasted. Everything else is ignored.
Comment 3 Sion 2022-06-21 22:38:28 UTC
Agree, that everything should be paste-able.

It would also solve another related problem I have. 
(Maybe I should open another ticket for this problem?)
I have a field with data that is not compatible with the Color Scale function:
it is a field with times, it was originally measured in minutes, but I didn't like it, so I translated that field to be more readable, but it is incompatible now:

ex:
Old time: 230 (minutes)
New time: 3h 50m (my "translation")

I would like to use the "Old time" field to generate the background colors, (then "lock" the colors?), and then "paste" those colors into the "New time" field, without changing the colors in the new field.

I think there is some very roundabout way to do this, I saw something about mapping letters to numbers, so it was possible to sort fields by text, or something like that, so maybe it is possible to map "3h 50m" to the value "230", but as said, it is a VERY roundabout way.

Another solution would be to type the "New Time" field as:
"3h 50m (230)" and then use a Regular-Expression to extract the "230" part of that text & use that for sorting.

Or a 3rd solution, would be to use a different "Source Column" (= "Old Time"), and use that column to generate the colors, and then have a "Destination Column" (= "New Time") where the colors is inserted.
Maybe it can be written with a similar syntax as eg. VLOOKUP() or ROUND() or similar functions?
Something like:
BACKGROUND_COLOR(source_range; target_range) or something like that?

(But again, maybe I should open another ticket for this problem?)
Comment 4 Heiko Tietze 2022-06-22 07:59:39 UTC
Writer is not Calc and you cannot have all functionality. But what you can do is to insert the sheet as Calc object with Edit > Paste Special or shift+ctrl+V. The default has changed around 6.4 for bug 116685. So clearly by design and NAB/WF.
Comment 5 Sion 2022-06-22 11:30:52 UTC
They are 2 different programs, correct observation. 
But the table in Writer could very well have similar behaviors as the tables in Calk, at least in this regard, and besides that, the code is already written in Calc, so it should be very little problems to just copy it over, rename some variables or whatever is needed, and have it function just fine even in Writer.
Comment 6 Heiko Tietze 2022-06-22 11:36:41 UTC
I'm afraid it's not so simple. Anyway, the OLE solution is IMO sufficient.
Comment 7 V Stuart Foote 2022-06-22 12:34:41 UTC
Agree, OLE delivers all facets of a Calc sheet for use in a Writer session (on page, in a Frame or in a Section).

But the ask for filter import (via copy/paste) to preserve direct formatting (or Styling) applied to cells of a Calc sheet is a reasonable enhancement. Just not clear how involved the filter work actually is.  Needs dev advice. GSOC worthy? Easy hackable?

@Miklos, Justin -- opinions?
Comment 8 Rafael Lima 2022-06-22 14:38:28 UTC
In my opinion, we do not need to add Calc features into Writer to automatically color tables.

All we need is a Copy - Paste from Calc to Writer that pastes borders, background colors and font formats. This way the user would be able to prepare a table in Calc and paste it into Writer as a table (not as an OLE object).

Pasting as an OLE object is not a good solution due to bugs 97423, 99953 and 135891. Also, OLE objects are very cumbersome to edit later in a document when compared to actual tables.