You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2008/05/05 15:59:11 UTC
svn commit: r653484 - in /poi/trunk/src:
documentation/content/xdocs/changes.xml
java/org/apache/poi/hssf/usermodel/HSSFSheet.java
Author: yegor
Date: Mon May 5 06:59:11 2008
New Revision: 653484
URL: http://svn.apache.org/viewvc?rev=653484&view=rev
Log:
take into account indentation in HSSFSheet.autosizeColumn
Modified:
poi/trunk/src/documentation/content/xdocs/changes.xml
poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=653484&r1=653483&r2=653484&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Mon May 5 06:59:11 2008
@@ -43,7 +43,7 @@
<action dev="POI-DEVELOPERS" type="fix">44914 - Fix/suppress warning message "WARN. Unread n bytes of record 0xNN"</action>
<action dev="POI-DEVELOPERS" type="fix">44892 - made HSSFWorkbook.getSheet(String) case insensitive</action>
<action dev="POI-DEVELOPERS" type="fix">44886] - Correctly process PICT metafile in EscherMetafileBlip</action>
- <action dev="POI-DEVELOPERS" type="fix">44893 - Correctly handle merged regions in HSSFSheet.autoSizeColumn</action>
+ <action dev="POI-DEVELOPERS" type="fix">44893 - Take into account indentation in HSSFSheet.autoSizeColumn</action>
</release>
<release version="3.1-beta1" date="2008-04-28">
<action dev="POI-DEVELOPERS" type="fix">44857 - Avoid OOM on unknown escher records when EscherMetafileBlip is incorrect</action>
Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=653484&r1=653483&r2=653484&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Mon May 5 06:59:11 2008
@@ -1710,6 +1710,8 @@
HSSFCellStyle style = cell.getCellStyle();
HSSFFont font = wb.getFontAt(style.getFontIndex());
+ //the number of spaces to indent the text in the cell
+ int indention = style.getIndention();
if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {
HSSFRichTextString rt = cell.getRichStringCellValue();
@@ -1742,9 +1744,9 @@
trans.concatenate(
AffineTransform.getScaleInstance(1, fontHeightMultiple)
);
- width = Math.max(width, layout.getOutline(trans).getBounds().getWidth() / defaultCharWidth);
+ width = Math.max(width, layout.getOutline(trans).getBounds().getWidth() / defaultCharWidth + indention);
} else {
- width = Math.max(width, layout.getBounds().getWidth() / defaultCharWidth);
+ width = Math.max(width, layout.getBounds().getWidth() / defaultCharWidth + indention);
}
}
} else {
@@ -1787,15 +1789,15 @@
trans.concatenate(
AffineTransform.getScaleInstance(1, fontHeightMultiple)
);
- width = Math.max(width, layout.getOutline(trans).getBounds().getWidth() / defaultCharWidth);
+ width = Math.max(width, layout.getOutline(trans).getBounds().getWidth() / defaultCharWidth + indention);
} else {
- width = Math.max(width, layout.getBounds().getWidth() / defaultCharWidth);
+ width = Math.max(width, layout.getBounds().getWidth() / defaultCharWidth + indention);
}
}
}
if (width != -1) {
- if (width > Short.MAX_VALUE) { //width can be bigger that Short.MAX_VALUE!
+ if (width > Short.MAX_VALUE) { //calculated width can be greater that Short.MAX_VALUE!
width = Short.MAX_VALUE;
}
sheet.setColumnWidth(column, (short) (width * 256));
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org