ASF Bugzilla – Attachment 33253 Details for
Bug 51622
autoSizeColumn incorrectly sizes columns containing leading whitespace
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
SheetUtil.java fix
bug51622.patch (text/plain), 1.75 KB, created by
Javen O'Neal
on 2015-11-04 03:28:53 UTC
(
hide
)
Description:
SheetUtil.java fix
Filename:
MIME Type:
Creator:
Javen O'Neal
Created:
2015-11-04 03:28:53 UTC
Size:
1.75 KB
patch
obsolete
>Index: src/java/org/apache/poi/ss/util/SheetUtil.java >=================================================================== >--- src/java/org/apache/poi/ss/util/SheetUtil.java (revision 1712459) >+++ src/java/org/apache/poi/ss/util/SheetUtil.java (working copy) >@@ -21,6 +21,7 @@ > import java.awt.font.TextAttribute; > import java.awt.font.TextLayout; > import java.awt.geom.AffineTransform; >+import java.awt.geom.Rectangle2D; > import java.text.AttributedString; > import java.util.Locale; > import java.util.Map; >@@ -165,6 +166,7 @@ > private static double getCellWidth(int defaultCharWidth, int colspan, > CellStyle style, double width, AttributedString str) { > TextLayout layout = new TextLayout(str.getIterator(), fontRenderContext); >+ final Rectangle2D bounds; > if(style.getRotation() != 0){ > /* > * Transform the text using a scale so that it's height is increased by a multiple of the leading, >@@ -177,10 +179,13 @@ > trans.concatenate( > AffineTransform.getScaleInstance(1, fontHeightMultiple) > ); >- width = Math.max(width, ((layout.getOutline(trans).getBounds().getWidth() / colspan) / defaultCharWidth) + style.getIndention()); >+ bounds = layout.getOutline(trans).getBounds(); > } else { >- width = Math.max(width, ((layout.getBounds().getWidth() / colspan) / defaultCharWidth) + style.getIndention()); >+ bounds = layout.getBounds(); > } >+ // entireWidth accounts for leading spaces which is excluded from bounds.getWidth() >+ final double frameWidth = bounds.getX() + bounds.getWidth(); >+ width = Math.max(width, ((frameWidth / colspan) / defaultCharWidth) + style.getIndention()); > return width; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51622
:
27352
|
27353
|
33253
|
33254