Bug 163168 - Sheet tab color not displayed correctly in LibreOffice when generated with Python libraries (xlsxwriter/openpyxl) after applying protection
Summary: Sheet tab color not displayed correctly in LibreOffice when generated with Py...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
24.2.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Cell-Sheet-Protection Sheet-Tabs-Bar
  Show dependency treegraph
 
Reported: 2024-09-26 16:14 UTC by Emanuel
Modified: 2024-10-15 02:21 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Script in python for testing. (672 bytes, text/x-python)
2024-09-26 16:17 UTC, Emanuel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuel 2024-09-26 16:14:01 UTC
Description:
It seems like when using openpyxl to color a tab and then protect that sheet, when you open that document using libreoffice it loses its tab color.

If you open it with another aplication like microsoft excel or google sheets the tab keeps that color. So I'm guessing it has nothing to do with openpyxl but with libreoffice calc since those atributtes are saved.

Steps to Reproduce:
1.Use this code to create an example using python:
from openpyxl import Workbook
from openpyxl.styles import PatternFill

# Create a new workbook and get the active sheet
wb = Workbook()
ws = wb.active

# Assign a name to the sheet
ws.title = "Main Sheet"

# Change the color of the sheet tab
ws.sheet_properties.tabColor = "1072BA"  # Color should be in hexadecimal RGB format

# Add some content to display in the sheet
ws['A1'] = "This is an example of a sheet with a colored tab and protection."

# Protect the sheet
ws.protection.sheet = True
ws.protection.password = 'my_password'

# Save the file
wb.save("colored_and_protected_sheet.xlsx")

print("File created and protected successfully.")


2.Open it with libreoffice calc and see that the tab doesn't have a color.
3.Open it with another program and see that the tab does have a color.

Actual Results:
There's no color on the tab after it got protected. But there's is color if you use another program so the color atribute is saved. But for some reasons Libreoffice doesn't read it.

Expected Results:
To see the tab colors even if the sheet is protected.


Reproducible: Always


User Profile Reset: No

Additional Info:
If you try to do it ussing the app (Libreoffice calc) you can put a color and then protect the sheet. It'll save the tab color. But not using openpyxl.
Comment 1 Emanuel 2024-09-26 16:17:54 UTC
Created attachment 196726 [details]
Script in python for testing.

It creates the file you need to check. You will see that in libreoffice the tab won't have a color but in other aplications will.
Comment 2 Saburo 2024-10-04 07:45:47 UTC
Reproduced using LibreOffice instead of Python

This happens in xlsx but not in ods.

Duplicate?
https://bugs.documentfoundation.org/show_bug.cgi?id=122945