OK. I have an answer and a solution for you.
First, the answer, default row heights. When you do this;
HSSFWorkbook workbook = new HSSFWorkbook();
....
workbook.write(outputStream);
Then you will get a workbook with sheets that have a default row height of
12.5.
If, on the other hand you do this;
XSSFWorkbook workbook = new XSSFWorkbook();
....
workbook.write(outputStream);
then you will have a workbook with sheets that have default row heights of
15.
That is the reason your users are seeing the discrepancies they are
reporting.
One solution (I am still to test another) is to use Excel to create blank
workbooks and to use these as templates when you create your own. You will
need to create two empty workbooks, one of each format. Then you can open a
workbook, get a sheet, build and save the file(s) just as you did before.
You will need to make one major change to your code;
HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(new
File("C:/temp/Template.xls")));
HSSFSheet sheet = workbook.getSheetAt(0);
and do the same sort of thing for the XSSFWorkbook.
If you have named the sheets in your template workbook(s) - which is quite
permissible - then you can get the sheet by name rather than index by
calling the getSheet(String) method on the workbook.
One thing I did find is that if you create new sheets in these template
workbooks using POI then the row heights will still remain the same.
I am going to test using the ss.usermodel to see if that sidesteps the issue
surrounding row heights and will let you know if I make any progress. Just
to complete the [picture, I did try setting the default row heights of both
workbooks and did not have any success at all with this approach.
--
View this message in context:
http://apache-poi.1045710.n5.nabble.com/Can-not-see-the-entire-cell-content-in-HSSF-tp5709814p5709872.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]