Bug 55968

Summary: [PATCH] Method autoSizeColumn with images
Product: POI Reporter: Rafael Moreti Santana <rafael.moreti>
Component: XSSFAssignee: POI Developers List <dev>
Severity: enhancement CC: rafael.moreti
Priority: P2 Keywords: PatchAvailable
Version: 3.9-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: Java Class with method autosizeCollum modified in case of images
autosizeColumn JUnit test

Description Rafael Moreti Santana 2014-01-07 17:50:56 UTC
Created attachment 31179 [details]
Java Class with method autosizeCollum modified in case of images

method autosizeColumn doesn't work right with images. The attachment has the repaired method.
Comment 1 Nick Burch 2014-01-08 14:36:10 UTC
Are you able to produce a unit test for this, and provide some documentation / javadocs / etc to help people work out when they'd want to use the current behaviour, and when they might want to use this instead?
Comment 2 Rafael Moreti Santana 2014-01-14 11:44:25 UTC
Sorry, the JUnit tests are from the company and they can't be shared. There is any test framework you use that can be shared so we can generate tests and post it here? I will send a documentation as soon as possible.
Comment 3 Rafael Moreti Santana 2014-01-15 15:42:31 UTC
Created attachment 31210 [details]
autosizeColumn JUnit test
Comment 4 Rafael Moreti Santana 2014-01-15 15:45:34 UTC
Just added attachment that contains a JUnit test of the modified method autosizeColumn. The test is based on the JUnit test of class TestXSSFSheet of POI 3.7. The modified method autosizeColumn can be used in any case, if the sheet contains an image or not.
Comment 5 Javen O'Neal 2016-03-12 20:49:23 UTC
Setting column width and auto-sizing columns in POI 3.14 is done via Sheet.get/setColumnWidth [1] and Sheet.autoSizeColumn [2]. 

The attached patch duplicates current functionality, so it looks like your problem of setting custom column widths is solved.

[1] https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Sheet.html
[2] https://poi.apache.org/spreadsheet/quick-guide.html#Autofit
Comment 6 Javen O'Neal 2016-03-12 20:52:15 UTC
Please reopen if you have code that can auto-sizing to image or chart width.