Add conditional formatting functionality #28
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Four core Python methods in
excelize.py
:new_conditional_style()
- Creates a new conditional formatting styleset_conditional_format()
- Applies conditional formatting to specified cell rangesunset_conditional_format()
- Removes conditional formatting from specific rangesclear_all_conditional_formats()
- Clears all conditional formatting from a worksheetCGO bridge implementation in
excelize_bridge.go
to support these Python methodsUpdated 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 operationssimple_condition_format_example.py
- A simple example demonstrating basic usagetest_unset_conditional_format.py
- Specific tests for the clear/remove functionalityTesting was performed on Windows using Python 3.9+ and Go 1.23+ with GCC for CGO compilation.
Types of changes
Checklist