Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is this happening while writing an Excel in Java
    primarykey
    data
    text
    <p>Ok, basically i'm trying to write 3 columns and N number of rows simultaneously while iterating. The problem is that 2 of the 3 columns are written with the values... even though they appear in the System.out.println(), are not being written in the Excel. Here's the code:</p> <pre><code>for(int i = 0; i &lt; versionsToGraph.length; i++) { List&lt;WsCallEntry&gt; wfCalls = allCalls.get(i); int cant = -1; if(!wfCalls.isEmpty()) { for (WsCallEntry wsCallEntry : wfCalls) { String x = wsCallEntry.getKey(); int y = wsCallEntry.getValue(); cant++; if(versionsToGraph[i].equals("15.6")) { System.out.println(x + " " + y + " will be added."); XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0); XSSFRow row = sheet.createRow(27+cant); XSSFCell celly = row.createCell(10); celly.setCellValue(y); }else{ if(versionsToGraph[i].equals("15.9")) { System.out.println(x + " " + y + " will be added."); XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0); XSSFRow row = sheet.createRow(27+cant); XSSFCell celly = row.createCell(11); celly.setCellValue(y); } } xValues.add(x); } Collections.sort(xValues, new StringComparator()); } } ArrayList&lt;String&gt; newList = eliminarRepetidos(xValues); int cant = 0; for (String newlist : newList) { String x = newlist; XSSFSheet sheet = (XSSFSheet) wb.getSheetAt(0); XSSFRow row = sheet.createRow(27+cant); XSSFCell cellx = row.createCell(9); cellx.setCellValue(x); cant++; } } </code></pre> <p>So, it should add in this part of the code, the 15.6, 15.9 Y values, and in the last foreach writes the X values in the Excel. What i'm getting is X values and 15.9 Y values. What am I not getting the 15.6 ones? :(</p> <p>(from the comment) I´m using these </p> <pre><code>import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFSheet; </code></pre>
    singulars
    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.
 

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