Skip to content

Add configurable WrapText measurement to AutoFitColumns (#2427) - #2428

Merged
swmal merged 4 commits into
develop8from
fix/WrappedTextAutofitMode
Jul 21, 2026
Merged

Add configurable WrapText measurement to AutoFitColumns (#2427)#2428
swmal merged 4 commits into
develop8from
fix/WrappedTextAutofitMode

Conversation

@swmal

@swmal swmal commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Implements #2427.
Adds a WrappedTextAutofitMode property to ExcelTextSettings, backed by a new eWrappedTextAutofitMode enum, giving control over how cells with WrapText enabled contribute to column width in AutoFitColumns().

Modes:

Skip — wrapped cells are ignored during autofit (default; preserves current behaviour).
FullText — the entire cell text is measured as a single line.
SplitNewLine — split on explicit line breaks (CR, LF, CRLF); widest line drives the width.
SplitWord — split on whitespace (space, tab, line breaks) and hyphens (U+002D, U+2010); widest segment drives the width. Visible hyphens are included in the segment width, whitespace is not.

Changes:

New eWrappedTextAutofitMode enum and WrappedTextAutofitMode property on ExcelTextSettings, propagated to the measurer.
Reworked MeasureTextInternal to measure per segment; the widest segment determines the result.
Fixed a pre-existing bug where East Asian character width accumulated across all lines instead of resetting per line.
Deprecated the internal MeasureWrappedTextCells flag via [Obsolete], mapping to the new enum.

Tests: Added coverage for all four modes plus CRLF handling, widest-segment-first, hyphen-as-visible-boundary, and the East Asian per-line reset.

Notes:

Applies to the generic font-metrics measurer; the System.Drawing measurer currently ignores the setting (to be addressed before the next release).
MeasureWrappedTextCells removal and the ITextMeasurer interface cleanup are deferred to EPPlus 9.

@swmal
swmal merged commit 70384af into develop8 Jul 21, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this to Pending Release in Epplus Enhancements Jul 21, 2026
@swmal
swmal deleted the fix/WrappedTextAutofitMode branch July 21, 2026 08:08
JanKallman added a commit that referenced this pull request Aug 4, 2026
…2451)

* Fixes issue #2392 (#2419)

* Versioning moved to Directory.Build.props and Build-release.yml adjusted for v9

* Add link to security considerations for formulas

* Update link for security considerations in SECURITY.md

* Bug/s1060 (#2426)

* Allow AppVersion in OfficeProperties to be set to null. #2393.

* WIP

* bug/s1063 SEARCH function Range on third arg (#2430)

* Tracking down the issue

* Found main issue. Arrays 3rd arg Search function

* Simplified test

* #2431 Fix formula cfvo load error in ext icon sets (#2432)

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* Add configurable WrapText measurement to AutoFitColumns (#2427) (#2428)

* #2427 - Add WrappedTextAutofitMode enum for configurable WrapText measurement in AutoFitColumns; fix per-line East Asian width reset

* Added tests. Might be correct despite failing test

* Fixed failing test

---------

Co-authored-by: Ossian Edström <ossian.edstrom@epplussoftware.com>
Co-authored-by: Jan Källman <jan.kallman@epplussoftware.com>

* Added DisableImageFunctionDownloads property to ParsingConfiguration. If true the IMAGE function will not download external content (#2436)

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* EPPlus version 8.6.2

* Updated version number on EPPlus.Interfaces and EPPlus.System.Drawing projects

* Security updates 8.6.3 - System.Security.Cryptography.Xml (#2438)

* Added DisableImageFunctionDownloads property to ParsingConfiguration. If true the IMAGE function will not download external content

* Update System.Security.Cryptography.Xml to 8.0.4/9.0.18/10.0.10 for CVE-2026-47302/47304/50525/50527/50648. Bump version to 8.6.3.

* Additional fixes för appveyor8.yml, fixedIssures.md and EPPlus project file

---------

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* #2443 - Fix header/footer picture loss when copying worksheets (#2444)

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* #2439 - Fix lookup regression when range starts before worksheet dimension; clamp both ends but keep range-relative offset (#2440)

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* #2441 - Added DisableImageFunctionDownloads property to ExcelCalculationOption (#2442)

Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>

* Centralize version in Directory.Build.props; embed sub-project DLLs in package

---------

Co-authored-by: Jan Källman <jan.kallman@epplussoftware.com>
Co-authored-by: karlkallman <137038948+karlkallman@users.noreply.github.com>
Co-authored-by: OssianEPPlus <122265629+OssianEPPlus@users.noreply.github.com>
Co-authored-by: swmal <{ID}+username}@users.noreply.github.com>
Co-authored-by: Ossian Edström <ossian.edstrom@epplussoftware.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Pending Release

Development

Successfully merging this pull request may close these issues.

3 participants