• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openpyxl / openpyxl / #865
96%
default: 96%

Build:
Build:
LAST BUILD BRANCH: 3.1
DEFAULT BRANCH: default
Ran 10 Jan 2026 03:13PM UTC
Jobs 1
Files 190
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

10 Jan 2026 03:13PM UTC coverage: 96.495% (-0.01%) from 96.507%
#865

push

coveralls-python

David Ropero
Add autofit() method for automatic column width adjustment

This commit introduces a new autofit() method in ColumnDimension that
automatically adjusts column widths based on cell content length.

Features:
- Uses public API: worksheet.cell(), min_row, max_row
- Configurable: min_width, max_width, width_factor parameters
- Robust: handles None values, multiline content (\n)
- Returns calculated width for debugging

Also includes:
- autofit_columns() helper method in Worksheet class
- Comprehensive test suite (13 new tests, all passing)
- Updated AUTHORS.rst with contributor

Performance: ~0.014s per column for 10k rows

This is a pragmatic approximation based on character count.
Excel's AutoFit uses complex calculations involving DPI, font metrics,
and rendering engine details that are not available to openpyxl.
This method provides a practical solution suitable for most use cases.

14920 of 15462 relevant lines covered (96.49%)

0.96 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
3
95.4
0.04% openpyxl/worksheet/worksheet.py
4
95.9
-0.49% openpyxl/worksheet/dimensions.py
Jobs
ID Job ID Ran Files Coverage
1 #865.1 10 Jan 2026 03:13PM UTC 190
96.49
Source Files on build #865
  • Tree
  • List 190
  • Changed 34
  • Source Changed 0
  • Coverage Changed 34
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 07ac7a1b on bitbucket
  • Prev Build on 3.2
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc