Bug 151839 - CharBackColor text property in Calc cells is available in API, but not exported to file formats, nor accessible from UI
Summary: CharBackColor text property in Calc cells is available in API, but not export...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.4.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Cells Dev-related
  Show dependency treegraph
 
Reported: 2022-10-31 09:04 UTC by Mike Kaganski
Modified: 2023-11-09 21:07 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2022-10-31 09:04:37 UTC
Since GSoC 2014's Matteo Campanelli's work on "Enhancing text frames" [1], EditEngine supports CharBackColor property. This can be used not only in Draw (as the GSoC project was called), but anywhere where EditEngine is used, including Calc's cells. This code works and makes first three characters in A1 to be white-on-black:

Sub SelectFirst3CharsInCell
    Dim oCell, oSheet, oCursor, oVCurs
    oSheet = thisComponent.CurrentSelection.getSpreadsheet
    oCell = oSheet.GetCellbyPosition(0, 0)	
    ThisComponent.CurrentController.Select(oCell)
    oCell.setString("12345")
    oCursor=oCell.Text.createTextCursor()
    oCursor.gotoStart(False)
    oCursor.goRight(3, true)
    oCursor.CharBackColor = RGB(0,0,0)
    oCursor.CharColor = RGB(255,255,255)
End Sub

In bug 88276, sidebar got a UI to set the property in text boxes (v.5.0); later in the same bug it was added also to character properties dialog for text box objects (v.5.1).

However, it never made it into Calc's cell character properties. Also it is not saved to ODS.

It either needs to get full support (writing to ODS, UI access), or should not be available from the API (the property is optional, so may be absent in case of Calc's cell).

[1] https://wiki.documentfoundation.org/Development/GSoC/Successfully_Implemented_Ideas#Improve_Text_Boxes_in_Draw
Comment 1 Vladimir Sokolinskiy 2022-10-31 11:32:51 UTC
Repro in:
Version: 7.4.2.3 (x64) / LibreOffice Community
Build ID: 382eef1f22670f7f4118c8c2dd222ec7ad009daf
CPU threads: 6; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: ru-RU (ru_RU); UI: ru-RU
Calc: threaded
Comment 2 Stéphane Guillou (stragu) 2023-11-05 17:32:53 UTC
We already had bug 39274, but I'm reluctant to mark this as a duplicate given how much detail Mike provided.
Comment 3 Mike Kaganski 2023-11-05 17:41:52 UTC
(In reply to Stéphane Guillou (stragu) from comment #2)

:-) I'm OK if my duplicated (with whatever level of details) are closed as dupes of other bugs; in the end, the details can be mentioned/copied there. OTOH, I myself tend to close *older* bugs with few detail level as duplicates of *newer* bugs of higher quality.

But in this case, it's not a duplicate. Bug 39274 is a request for that functionality; it was filed in 2011, when the code that I'm talking about didn't exist.

This bug 151839 is about existing functionality, introduced in 2014, that is incomplete. One of *viable* options for resolving/fixing this bug 151839 is to *remove* the API from Calc - something that would make it consistent, so would resolve this issue - but that would not resolve bug 39274.

Of course, this bug 151839 is a good code pointer for anyone who would like to implement the rest for bug 39274.