If I try to remove cell style formatting on a Calc sheet cell range by a macro, nothing happens:
But if I combine STYLES with HARDATTR, not only all hard formatting is set to default, but formatting with cell styles is removed as well. This way you can remove cell style formatting, but with the drawback of getting default formats in the rest of the cells.
This behavior is proved for Windows 7, LO 5.3.7., Windows 10, LO 188.8.131.52 (32 bit) and for Linux openSUSE LEAP 42.2 with LO 5.3.0 and LO 184.108.40.206 (both generic versions).
Steps to Reproduce:
1. Format a sheet cell with some cell style.
2. Take a cell range oRange containing that cell.
4. Nothing happens
5. oRange.clearContents(com.sun.star.sheet.CellFlags.HARDATTR Or com.sun.star.sheet.CellFlags.STYLES)
With (com.sun.star.sheet.CellFlags.STYLES) alone nothing happens.
With (com.sun.star.sheet.CellFlags.HARDATTR Or com.sun.star.sheet.CellFlags.STYLES) all cells in the range are reset to default formats incl. the cell with cell style.
With (com.sun.star.sheet.CellFlags.STYLES) alone all cells formatted by cell styles should be reset to default formats.
User Profile Reset: No
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
+ LibO 220.127.116.11 (x64) @ Windows 7 Home Premium 64-bit
+ LibO 18.104.22.168 (x64) @ Windows 7 Home Premium 64-bit
I can confirm it for LibO 22.214.171.124 32-Bit, Windows 10
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug.
(Please note that the attachment will be public, remove any sensitive information before attaching it.
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)
Created attachment 140291 [details]
Macros to display bugs using Calc cell range method clearContents with some CellFlags
This attachment shows a set of formatted cells, numbers, date/time, strings, B3 being formatted with a cell style, as well as two cells (B4 and C4) with text portion formatting.
You can try the effect on B3 (in fact no effect at all) by calling the macro
If you call the macro
then not only all cell formatting is set to default, but B3 loses the cell style, too.
The file comes with an additional macro to serve as an example for bug 116127 as well:
What would happen if nDelFlag has STYLES only when (ATTRIB == (HARDATTR | STYLES))?
I first thought it could be ok if I rewrite
(nDelFlag & InsertDeleteFlags::ATTRIB) != InsertDeleteFlags::NONE
(nDelFlag & InsertDeleteFlags::ATTRIB) == InsertDeleteFlags::ATTRIB
, but in that case it seems, at least to me , that we would not at all need else-if section.
Dear Volker Lenhardt,
To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.
There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.
If you have time, please do the following:
Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/
If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.
Please DO NOT
Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not
appropriate in this case)
If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/
2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword
Feel free to come ask questions or to say hello in our QA chat: https://kiwiirc.com/nextclient/irc.freenode.net/#libreoffice-qa
Thank you for helping us make LibreOffice even better for everyone!
As with LO 126.96.36.199 and 188.8.131.52 both on macOS Big Sur (11.6) and with LO 184.108.40.206 on openSUSE Leap Tumbleweed there is no different behaviour. The bug persists as specified before.
With regards, Volker
In addition: With LO 3.3.0 on Linux openSUSE Tumbleweed (Leap 15.2) the macro removes all hard attributes, but leaves the cell styles untouched. Weird. It should have done the other way round. But this is history.