[seam-commits] Seam SVN: r9186 - trunk/src/excel/org/jboss/seam/excel/jxl.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Oct 3 16:05:14 EDT 2008


Author: nickarls
Date: 2008-10-03 16:05:13 -0400 (Fri, 03 Oct 2008)
New Revision: 9186

Modified:
   trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java
Log:
Fix ratio problem with images

Modified: trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java
===================================================================
--- trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java	2008-10-03 19:57:11 UTC (rev 9185)
+++ trunk/src/excel/org/jboss/seam/excel/jxl/JXLExcelWorkbook.java	2008-10-03 20:05:13 UTC (rev 9186)
@@ -449,8 +449,10 @@
 
       int useStartColumn = uiImage.getStartColumn() == null ? currentColumnIndex : uiImage.getStartRow();
       int useStartRow = uiImage.getStartRow() == null ? currentRowIndex : uiImage.getStartRow();
-      double useColumnSpan = uiImage.getColumnSpan() == null ? ((double)(image.getWidth() / CELL_DEFAULT_WIDTH)) : uiImage.getColumnSpan();
-      double useRowSpan = uiImage.getRowSpan() == null ? ((double)(image.getWidth() / CELL_DEFAULT_HEIGHT)) : uiImage.getRowSpan();
+      double estimatedRowSpan = (double)image.getHeight() / (double)CELL_DEFAULT_HEIGHT;
+      double estimatedColSpan = (double)image.getWidth() / (double)CELL_DEFAULT_WIDTH;
+      double useColumnSpan = uiImage.getColumnSpan() == null ? estimatedRowSpan : uiImage.getColumnSpan();
+      double useRowSpan = uiImage.getRowSpan() == null ? estimatedColSpan : uiImage.getRowSpan();
 
       worksheet.addImage(new WritableImage(useStartColumn, useStartRow, useColumnSpan, useRowSpan, pngStream.toByteArray()));
    }




More information about the seam-commits mailing list