Jump to content

v_i_y

Members
  • Posts

    4
  • Joined

  • Last visited

v_i_y's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare

Recent Badges

0

Reputation

  1. I was fighting the same problem all day long today. My goal was similar to yours: I want to export 300 DPI JPG image to Excel (I use JExcelApiExporter) and want that Excel file stores unchanged JPG which will be scaled by Excel when it is displayed on screen in low-DPI (72 or 96) but will be sent to printer in original 300-DPI (so it will be printed with good quality too). It is absolutely possible with Excel file format - I tested it with manually created file. In other words: I have the 100*100 pixels (in terms of Jasper/iReport coordinate system) box for the image in desing file and I have ~400*400 pixels JPG file to place into the box. I found that JExcelApiExporter doesn't provide any way to export unchanged JPG into Excel - it always resize the image to be 100*100 (and it doesn't matter which scaleImage you use - scaleImage="RetainShape" also resizes) . But I found the workaround. I little changed method exportImage() of JExcelApiExporter: my version looks like: WritableImage image = new WritableImage( col - emptyCols, row, gridCell.getColSpan(), isCollapseRowSpan ? 1 : gridCell.getRowSpan(), renderer.getImageData() // FIX: this is a single important change // was: JRImageLoader.loadImageDataFromAWTImage(bi, JRRenderable.IMAGE_TYPE_PNG) ); so I never export image redrawn on 100*100 canvas by Java2D - original (unchanged) file is always exported. PS. Unfortunally (because of private access to some members/methods) I couldn't only extend my own Exporter from JExcelApiExporter and override only exportImage() - I had to copy the whole sources of JExcelApiExporter to my class for fixing just one line of code :( PS2. JasperReports 3.7.1 (But I tried in 3.7.3 too - the same problem) Post Edited by viy75 at 06/25/2010 20:32 Post Edited by viy75 at 06/25/2010 20:34
  2. It seems that POI has method for setting sheet margins: poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Sheet.html#setMargin%28short,%20double%29
  3. Hi guys. I've encountered the same problem. And I guess the problem is better explained in forum topic: "How to set MS Excel sheet margins?" http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=28559 Just wanted to finalize this thread :)
  4. Hi Teodor, thanks for the reply. Has the situation been changed since 2007? I encountered the same problem in the current version (3.7.1) of JR/iReport: JRXlsExporter always set XLS page margins (I mean Excel page setup params) to something like 1.9/2.5 cm for left/top (rigth/bottom) JExcelApiExporter always set them to 0/0 cmSo if 1.9/2.5 are very big for me, I encoraged to use only JExcelApiExporter and set IGNORE_PAGE_MARGINS=FALSE then margins are emulated by adding empty cells with correspondent width/height. So is it still bottleneck in underlying libs (POI, JExcel API)? Do I use correct workaround for the problem? Thanks in advance.
×
×
  • Create New...