ASF Bugzilla – Attachment 27007 Details for
Bug 51160
[PATCH] Provide ability to produce very large xlsx files using the regular high level API with the default heap space of 64MB
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Test case for differences in image output for the formats HSSF, XSSF and SXSSF
ImageTest.java (text/x-java-source), 2.10 KB, created by
Alex Geller
on 2011-05-16 09:44:43 UTC
(
hide
)
Description:
Test case for differences in image output for the formats HSSF, XSSF and SXSSF
Filename:
MIME Type:
Creator:
Alex Geller
Created:
2011-05-16 09:44:43 UTC
Size:
2.10 KB
patch
obsolete
>import org.apache.poi.ss.usermodel.Workbook; >import org.apache.poi.ss.usermodel.Sheet; >import org.apache.poi.ss.usermodel.Row; >import org.apache.poi.ss.usermodel.Cell; >import org.apache.poi.ss.usermodel.Drawing; >import org.apache.poi.ss.usermodel.CreationHelper; >import org.apache.poi.ss.usermodel.ClientAnchor; >import org.apache.poi.ss.usermodel.Picture; >import org.apache.poi.hssf.usermodel.HSSFWorkbook; >import org.apache.poi.xssf.usermodel.XSSFWorkbook; >import org.apache.poi.xssf.streaming.SXSSFWorkbook; >import org.apache.poi.util.IOUtils; >import java.io.FileOutputStream; >import java.io.FileInputStream; >import java.io.IOException; > >public class ImageTest >{ > public static void main(String[] args) throws IOException > { > generate(new HSSFWorkbook(),"HSSFOutput.xls"); > generate(new SXSSFWorkbook(),"SXSSFOutput.xlsx"); > generate(new XSSFWorkbook(),"XSSFOutput.xlsx"); > } > static void generate(Workbook wb,String fileName) throws IOException > { > Sheet sheet=wb.createSheet("Main Sheet"); > Row row0=sheet.createRow(0); > Row row1=sheet.createRow(1); > Cell cell=row1.createCell(0); > row0.createCell(1); > row1.createCell(0); > row1.createCell(1); > > FileInputStream is = new FileInputStream("./test-data/spreadsheet/logoKarmokar4.png"); > byte[] pictureData = IOUtils.toByteArray(is); > is.close(); > > //byte[] pictureData = HSSFTestDataSamples.getTestDataFileContent("logoKarmokar4.png"); > > int handle = wb.addPicture(pictureData, Workbook.PICTURE_TYPE_PNG); > Drawing drawing = sheet.createDrawingPatriarch(); > CreationHelper helper = wb.getCreationHelper(); > ClientAnchor anchor = helper.createClientAnchor(); > anchor.setAnchorType(ClientAnchor.DONT_MOVE_AND_RESIZE); > anchor.setCol1(0); > anchor.setRow1(0); > Picture picture=drawing.createPicture(anchor, handle); > > //row0.setHeightInPoints(72); > row0.setHeightInPoints(144); > picture.resize(); > > FileOutputStream out = new FileOutputStream(fileName); > wb.write(out); > out.close(); > } >}
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 Raw
Actions:
View
Attachments on
bug 51160
:
26964
|
27006
| 27007