Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:06:16+00:00 2026-05-26T10:06:16+00:00

Ok, basically i’m trying to write 3 columns and N number of rows simultaneously

  • 0

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:

for(int i = 0; i < versionsToGraph.length; i++) {           
                    List<WsCallEntry> 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<String> 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++;
                }               
            }

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? 🙁

(from the comment)
I´m using these

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;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:06:17+00:00Added an answer on May 26, 2026 at 10:06 am

    You are creating the same row on every iteration of versionsToGraph, you are erasing what was added in previously.

    XSSFRow row = sheet.createRow(27+cant);
    

    You should be doing

    sheet.getRow(27+cant);
    

    after the first iteration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I'm trying to accomplish the same thing that mailto:bgates@microsoft.com does in Internet Explorer
Basically I have written a game plugin that will allow server admins to update
Basically I am trying to restart a service from a php web page. Here
Basically, I'm trying to tap into the Soap pipeline in .NET 2.0 - I
Basically I’ve heard that certain conditions will cause .NET to blow past the finally
Basically, what I'm trying to create is a page of div tags, each has
Basically I have a drop down list which is populated with text and values
basically i need to write a query for mysql, but i have no experience
Basically i have a query string that when i hardcode in the catalogue value
Basically what I have here is a button that adds a new list item

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.