Hi Mark,

thanks for your reply.

Your test is running as expected in my setup. I'm currently trying to
extract the problematic code from my application..this may take a while ;)



> Hello again Jan,
> 
> I suspect there may be other problems because I cannot reproduce your
> results. This morning, I put together some test code that allowed me to test
> when I called the setColumnWidth(int, int) method and could not make it fail
> in the way you described. This is my test code;
> 
>         File outputFile = null;
>         FileOutputStream fos = null;
>         HSSFWorkbook workbook = null;
>         HSSFSheet sheet = null;
>         HSSFRow row = null;
>         HSSFCell cell = null;
>         try {
>             outputFile = new File("C:/temp/Column Test.xls");
>             fos = new FileOutputStream(outputFile);
> 
>             workbook = new HSSFWorkbook();
>             sheet = workbook.createSheet("Column Test.");
>             
>             //sheet.setColumnWidth(0, 1000);
>             
>             row = sheet.createRow(0);
>             cell = row.createCell(0);
>             cell.setCellValue("Just as a test.");
> 
>             sheet.setColumnWidth(0, 5000);
> 
>             workbook.write(fos);
>         }
>         catch(IOException ioEx) {
>             System.out.println("Caught an: " + ioEx.getClass().getName());
>             System.out.println("Message: " + ioEx.getMessage());
>             System.out.println("Stacktrace follows:.....");
>             ioEx.printStackTrace(System.out);
>         }
>         finally {
>             if(fos != null) {
>                 try {
>                     fos.close();
>                 }
>                 catch(IOException ioEx) {
>                     // Ignore - too late to recover anything now.
>                 }
>             }
>         }
> 
> Which, as you can see has the setColumnWidth(int, int) method in two places,
> before any cells are created and after. Whenevr I call the method it works;
> you can try this out for yourself, just comment and un-comment the code to
> use the respective calls.
> 
> Yours
> 
> Mark B
> 
> 
> Jan Richter wrote:
>> Hi,
>>
>> if i call HSSFSheet.setColumnWidth() prior to creating any rows or cells
>> the setColumnWidth() work. If i call it after i created my rows and
>> cells it do not work.
>>
>> Is this a bug or a feature?
>>
>>
>> I'm using POI 3.6
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to