Bug 108220 - Add Character styles in Calc cells
Summary: Add Character styles in Calc cells
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Depends on:
Blocks: Calc-Styles
  Show dependency treegraph
Reported: 2017-05-29 12:22 UTC by Thomas Lendo
Modified: 2017-08-27 00:13 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Lendo 2017-05-29 12:22:45 UTC
Today there are only cell and page styles in the Styles and Formatting sidebar in Calc available. Similar to the character style feature in Writer, it would be useful to have the same for the content/input in Calc cells to format a single character/word/digit in addition to a whole cell style.

The character dialog and the Styles and Formatting appearance in Writer could be reused in Calc.

I don't know if ODF supports such character styles anyway.
Comment 1 Yousuf Philips (jay) (retired) 2017-05-30 05:50:28 UTC
I doubt there is the ability with spreadsheets to have character styles or else we would have had it already and the same feature would already exist in Excel, which it doesnt. If someone disagrees, please reopen.
Comment 2 Thomas Lendo 2017-05-30 07:31:35 UTC
(In reply to Yousuf Philips (jay) from comment #1)
> I doubt there is the ability with spreadsheets to have character styles or
> else we would have had it already and the same feature would already exist
> in Excel, which it doesnt. If someone disagrees, please reopen.
If these are the only arguments against this feature then please reopen the bug. Because that aren't arguments. With that the most feature requests could be closed.

MSO Excel is a good comparison when a feature is missing in LibO, but not for a completely new feature. LibO should be more than an Excel clone.

To the technical worry:
Table cells with their cell styles contain a text:p element which can have a text:span element if there is some manual formatting of the cell content (that is a fact today). I can't see any difference to Writer in this case, principally. Even it could be possible to have paragraph and character styles within a cell style! What cool things you could do with this ...

@Regina, what's your thought regarding ODF spec?
Comment 3 Heiko Tietze 2017-05-30 08:15:41 UTC
Do you have a use case / scenario that describes the advantage of a character style? I mean who enters that much text into Calc that part of this text needs special formatting with styles?
Comment 4 Cor Nouws 2017-05-30 08:32:08 UTC
I'm a heavy user of character styles. In Writer. In Impress I would appreciate to have them, for now and then. But in Calc.. 
I don't object, but the change that I'll use them is very low. And then looking at how other already _not_ use cell styles..
So, no objection, but I would put my money&time on many other features first. (Which is irrelevant in deciding to keep an issue open or not :p )
Comment 5 Thomas Lendo 2017-05-30 08:59:42 UTC
Use case see https://bugs.documentfoundation.org/attachment.cgi?id=133664 of bug 107965. Many single characters have a color or are bold. What should the user do if he need italics+green instead of bold+black?

I also use spreadsheets in my company with thousands of rows where special formatting like character style in Writer would simplify workflow and maintainability.

Not using cell styles in Calc isn't a good argument against this bug. Most people don't use styles in Writer but we have this wonderful feature for interested users.
Comment 6 Heiko Tietze 2017-05-30 09:07:45 UTC
It's pretty simple to make a character bold. Having a character styles would allow to change all bold chars into italic. To me the formatting in Calc is still cell based as the equivalent to character style. Otherwise you add many information into one cell, what I don't see in the Beatles example.
Comment 7 Thomas Lendo 2017-05-30 09:40:17 UTC
(In reply to Heiko Tietze from comment #6)
> To me the formatting in Calc is
> still cell based as the equivalent to character style. Otherwise you add
> many information into one cell, what I don't see in the Beatles example.
But the information is already there in the file. Using manual formatting is the same thing (in principle) but without a GUI and without maintainability for all content with the same style (e.g. bold).

For me, cells are similar to paragraphs because there is (already available) the possibility to format a small part of the content of a cell.
Comment 8 Cor Nouws 2017-05-30 10:15:27 UTC
OK, Thomas example convinced me. Simply New!
Comment 9 Yousuf Philips (jay) (retired) 2017-05-30 19:26:16 UTC
Well lets see what Regina says about the ODF spec and hear Eike's take on the plausibility of this enhancement. I would assume that if this feature was implemented, it wouldnt be interoperable with OOXML.
Comment 10 Yousuf Philips (jay) (retired) 2017-06-17 12:58:22 UTC
Eike: Any thoughts on this enhancements?
Comment 11 Yousuf Philips (jay) (retired) 2017-06-17 13:21:18 UTC
What moggi said on IRC:

<moggi> well, the problem is that you could never use character styles in formula results which reduces the usefulness
<moggi> IMHO if you need complex formatting use a writer table, if you need complex calculations use calc
<jphilipz> being unable to use character styles in formula is a limitation of the file format?
<moggi> of how spreadsheet formulas work
<moggi> it is not only character styles, you can not use any character formatting in formula results
<moggi> you can format a whole cell but not single characters
<jphilipz> yep that would just limited character styles to just general formatted texts
<moggi> in general ODF and OOXML are normally our smallest problems, we can extend both formats
<moggi> of course we try to avoid extending the format and limit it to useful requests
Comment 12 Eike Rathke 2017-06-19 10:50:07 UTC
Adding character styles would be a matter of adding them to the EditEngine (which is used to edit cells and for display as soon as in-cell formatting is involved). Which then could also be made available in Draw and Impress. I don't see a problem with ODF, in fact when writing ODF we create adhoc automatic styles for in-cell formatting. OOXML could work similar, but I don't know.

However, making EditEngine support character styles on selections would be quite an effort.

Moggi's comments about formulas of course hold, in-cell formatting, be it styles or hard formatting, will not be supported.
Comment 13 Thomas Lendo 2017-06-20 11:37:55 UTC
Thanks for your comments about this issue.

I don't see a problem that styles can't be used in formula. That's already not possible with direct formatting. Character styles should not be more powerful than what's possible with direct character formatting today as far as I can see. Is there a use case to use formatting inside of formulae?

The question for character styles in Calc is not because of the need of complex formatting but because of maintainability of the formatting of large bulk of data. That's not doable with Writer tables.
Comment 14 Thomas Lendo 2017-06-21 20:29:39 UTC
From a short irc conversation with moggi:

<Me> But the point nobody answered: in XML level, character styles  work now in text:span elements with styles that are defined like direct formatted character styles in Writer. All what needed is to use this existing feature and 1) make it visible to the user in the styles and formatting sidebar deck and 2) make it possible to reuse a defined character style name (T24 or whatever) in other cells.

<moggi> ThomasLeno: in ODF that is not a problem, there is not much difference between hard formatting and styles, but implementing all the hard logic in calc is nearly impossible

<moggi> that does not even go into the interop problems

<Me> Ok, so it's an interop and in LibO an implementation problem.

<moggi> yes