diff options
author | Ugo Cei <ugo@apache.org> | 2008-01-21 09:56:56 +0000 |
---|---|---|
committer | Ugo Cei <ugo@apache.org> | 2008-01-21 09:56:56 +0000 |
commit | f9814d58e60840b4069a23409ea7871d3f5e7261 (patch) | |
tree | 37ed34b16e1887863573e27d61eb9aa30c8da4fe /src/java/org/apache/poi | |
parent | 1ddcefa55ea5a9f8b52b9a51217b83ce3bf95b76 (diff) | |
download | poi-f9814d58e60840b4069a23409ea7871d3f5e7261.tar.gz poi-f9814d58e60840b4069a23409ea7871d3f5e7261.zip |
Merged revisions 613395-613401 via svnmerge from
https://svn.apache.org/repos/asf/poi/trunk
........
r613395 | yegor | 2008-01-19 15:27:02 +0100 (Sat, 19 Jan 2008) | 1 line
use JDK 1.4 compatible constructor for IllegalStateException
........
r613396 | yegor | 2008-01-19 15:28:10 +0100 (Sat, 19 Jan 2008) | 1 line
add a check to prevent NPE in HSSFSheet.autoSizeColumn(). See Bug 44246
........
r613400 | yegor | 2008-01-19 15:44:07 +0100 (Sat, 19 Jan 2008) | 1 line
added unit tests for closed Bug 37684: Unhandled Continue Record Error
........
r613401 | yegor | 2008-01-19 15:54:06 +0100 (Sat, 19 Jan 2008) | 1 line
added a unit test for fixed bug 41139: Constructing HSSFWorkbook is failed,threw threw ArrayIndexOutOfBoundsException for creating UnknownRecord
........
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@613822 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r-- | src/java/org/apache/poi/hssf/record/DVRecord.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java | 41 |
2 files changed, 26 insertions, 22 deletions
diff --git a/src/java/org/apache/poi/hssf/record/DVRecord.java b/src/java/org/apache/poi/hssf/record/DVRecord.java index e5527d61f1..a7b68a1743 100644 --- a/src/java/org/apache/poi/hssf/record/DVRecord.java +++ b/src/java/org/apache/poi/hssf/record/DVRecord.java @@ -187,10 +187,13 @@ public class DVRecord extends Record this.field_not_used_2 = in.readShort(); //read sec formula data condition - // Not sure if this was needed or not... + //Not sure if this was needed or not... try { in.skip(this.field_size_sec_formula); - } catch(IOException e) { throw new IllegalStateException(e); } + } catch(IOException e) { + e.printStackTrace(); + throw new IllegalStateException(e.getMessage()); + } token_pos = 0; while (token_pos < this.field_size_sec_formula) diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java index bb779fef36..0250a4cbaa 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java @@ -1748,27 +1748,28 @@ public class HSSFSheet } else if (cell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN) { sval = String.valueOf(cell.getBooleanCellValue()); } + if(sval != null) { + String txt = sval + defaultChar; + str = new AttributedString(txt); + copyAttributes(font, str, 0, txt.length()); - String txt = sval + defaultChar; - str = new AttributedString(txt); - copyAttributes(font, str, 0, txt.length()); - - layout = new TextLayout(str.getIterator(), frc); - if(style.getRotation() != 0){ - /* - * Transform the text using a scale so that it's height is increased by a multiple of the leading, - * and then rotate the text before computing the bounds. The scale results in some whitespace around - * the unrotated top and bottom of the text that normally wouldn't be present if unscaled, but - * is added by the standard Excel autosize. - */ - AffineTransform trans = new AffineTransform(); - trans.concatenate(AffineTransform.getRotateInstance(style.getRotation()*2.0*Math.PI/360.0)); - trans.concatenate( - AffineTransform.getScaleInstance(1, fontHeightMultiple) - ); - width = Math.max(width, layout.getOutline(trans).getBounds().getWidth() / defaultCharWidth); - } else { - width = Math.max(width, layout.getBounds().getWidth() / defaultCharWidth); + layout = new TextLayout(str.getIterator(), frc); + if(style.getRotation() != 0){ + /* + * Transform the text using a scale so that it's height is increased by a multiple of the leading, + * and then rotate the text before computing the bounds. The scale results in some whitespace around + * the unrotated top and bottom of the text that normally wouldn't be present if unscaled, but + * is added by the standard Excel autosize. + */ + AffineTransform trans = new AffineTransform(); + trans.concatenate(AffineTransform.getRotateInstance(style.getRotation()*2.0*Math.PI/360.0)); + trans.concatenate( + AffineTransform.getScaleInstance(1, fontHeightMultiple) + ); + width = Math.max(width, layout.getOutline(trans).getBounds().getWidth() / defaultCharWidth); + } else { + width = Math.max(width, layout.getBounds().getWidth() / defaultCharWidth); + } } } |