Skip to content

Conversation

HergenD
Copy link

@HergenD HergenD commented Nov 28, 2024

Problem:

Users cannot currently set the tab color of worksheets using the extension. Setting tab colors is a valuable feature for organizing and visually distinguishing worksheets within a workbook, enhancing user experience and productivity.

Solution:

This pull request adds the setTabColor method to the Excel class, enabling users to set the color of the current worksheet's tab. The method leverages the worksheet_set_tab_color function from libxlsxwriter to apply the specified color.

Changes Made:

  • Added setTabColor Method:
    • Implemented setTabColor in excel.c, which accepts a color parameter corresponding to predefined color constants.
  • Registered Color Constants:
    • Added color constants (e.g., COLOR_RED, COLOR_BLUE) to the Excel class for easy reference in PHP code.
  • Updated Method Entries:
    • Included the new method in the xls_methods[] array for integration into the extension.
  • Added Test Case:
    • Created set_tab_color.phpt to test setting the tab color and ensure the method functions correctly.
    • The test confirms that the tab color is applied without errors and the Excel file is generated properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant