Skip to content

Conversation

Leo012345678
Copy link
Contributor

@Leo012345678 Leo012345678 commented Aug 23, 2025

PR Details

This PR has added complete conditional formatting functionality to the Excelize-py project, enabling it to perform conditional formatting operations that are compatible with the original Go Excelize library.

Description

This PR introduces comprehensive conditional formatting functionality, thereby enhancing the processing capabilities of this library for Excel files. The implementation approach includes:

  1. Four core Python methods in excelize.py:

    • new_conditional_style() - Creates a new conditional formatting style
    • set_conditional_format() - Applies conditional formatting to specified cell ranges
    • unset_conditional_format() - Removes conditional formatting from specific ranges
    • clear_all_conditional_formats() - Clears all conditional formatting from a worksheet
  2. CGO bridge implementation in excelize_bridge.go to support these Python methods

  3. Updated documentation in README.md to reflect the new functionality and project structure

Related Issue

N/A

Motivation and Context

Conditional formatting is a frequently used feature in spreadsheet applications, allowing users to apply formatting rules based on cell values. This implementation brings parity with the original Go Excelize library's conditional formatting capabilities to the Python port, making the library more complete and useful for real-world applications.

The changes enable users to create visually enhanced spreadsheets with dynamic formatting that adapts to data changes, improving data visualization and analysis capabilities.

How Has This Been Tested

The implementation has been thoroughly tested using:

  • comprehensive_conditional_format_test.py - A dedicated test script that verifies all conditional formatting operations
  • simple_condition_format_example.py - A simple example demonstrating basic usage
  • test_unset_conditional_format.py - Specific tests for the clear/remove functionality
  • Manual validation of generated Excel files with various conditional formatting scenarios

Testing was performed on Windows using Python 3.9+ and Go 1.23+ with GCC for CGO compilation.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

codecov bot commented Aug 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (c1c7535) to head (e63654d).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #28   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines         2931      2944   +13     
=========================================
+ Hits          2931      2944   +13     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xuri xuri merged commit 09b56ec into xuri:main Aug 24, 2025
19 checks passed
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.

2 participants