Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving trouble with WritableSheet.addImage(WritableImage)
    primarykey
    data
    text
    <p>I'm using jxl (JExcelApi) to save an Excel file, by copying an existing Excel file to a new file and modifying the copy. I've had great success in doing so, except for one issue. </p> <p>I'm trying to save two different PNG images at two different locations in the Excel sheet. I call the following function two successive times (once for each image), with a different row index and a different pngFile each time:</p> <pre><code>private static void putPngInExcel(File pngFile, int column, int row, int widthInColumns, int heightInRows, WritableSheet worksheet) { WritableImage image = new WritableImage(column, row, widthInColumns, heightInRows, pngFile); worksheet.addImage(image); } </code></pre> <p>Basically, it seems that if I call the above function twice, only the second call does what it should, ie. only the second PNG image appears in the Excel sheet, not the first PNG image. Maybe I'm doing something silly, but I'm wondering if anyone is aware of a known jxl issue in this regard?</p> <p>I'm not seeing any uncaught Exceptions being thrown. </p> <p>I've confirmed that valid PNG Files are being passed to the above function both times it is executed. </p> <p>I've swapped which PNG File goes to each call of the above function, and confirmed that the PNG associated with the second function call is always the one that gets added to the Excel sheet successfully. </p> <p>I've deleted one of the calls to the above function, leaving one call, and confirmed that I do see the relevant PNG image on the Excel sheet as I should (I tried passing different combinations of PNG files and row/column indices and it worked fine for one call to the above function). </p> <p>I haven't tried more than two calls, but it looks like only the most recent call to the above function works. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload