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

  • Home
  • SEARCH
  • 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 8373045
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:34:51+00:00 2026-06-09T14:34:51+00:00

I am currently doing a program in Java that will run several tests and

  • 0

I am currently doing a program in Java that will run several tests and generate a report right after in excel. I was able to read and write through excel and the results of Passed or Failed are displayed in Results column. I was able to write these in excel but by supplying a default value on the cell (e.g. default) so the code will just overwrite it. I would like to write a comment on the Comment column, but I do not know how to write in a null cell. Here is a screenshot of the report I am generating (the link of the image available) and the code for reading and writing in excel as well.

FileInputStream fileInputStream = new FileInputStream("ReportExcel.xls");
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream);
HSSFSheet worksheet = workbook.getSheetAt(0);   

fileInput csvInputFile = new fileInput();
String[] sReturnValue = csvInputFile.arrayReturnSingleValue("fileInput.csv");
if (prodnameresult.equals(prodname) ){
    Pass++;
    totalResult++;
    System.out.println ("Testcase1: Branding-Customised Product Name is PASSED");
    //Harold's Input    
        HSSFRow row = worksheet.getRow(1);
        HSSFCell cell = row.getCell((short) 4);
        cell.setCellValue("Passed");
    } 
else{
    Fail++;
    totalResult++;
    System.out.println("Testcase1: Branding-Customised Product Name is FAILED");
    //assertEquals(prodnameresult.equals(prodname), true);
    //Harold's Input
         HSSFRow row = worksheet.getRow(1);
         HSSFCell cell = row.getCell((short) 4);
         cell.setCellValue("Failed");
    }

//Harold's Input
    FileOutputStream os = new FileOutputStream("ReportExcel.xls");
    workbook.write(os);
    os.close();
}

Report:

http://i47.tinypic.com/2s1lsfc.png

  • 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-06-09T14:34:52+00:00Added an answer on June 9, 2026 at 2:34 pm

    I don’t have access to the report, but to answer to your question, if your cell is null you should create it and not get it as following:

    HSSFCell cell = row.getCell((short) 4);
    if(cell == null)
       cell = row.createCell((short) 4);
    cell.setCellValue("Passed");
    

    You should maybe re-apply the Style to the Cell if it had a different one from the row.

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

Sidebar

Related Questions

I'm currently working with Java to write a program that does an EAI between
Im currently doing a console app that has to send scheduled emails. In one
I am currently doing a C# WPF application that generates a table that does
I'm currently doing the calculator app that has the graph functionality. So then, I
I am currently doing an android application that contains customize alert dialog. It contains
I wrote a program that downloads some files from some servers. Currently program works
I am generating large PNG files from a Scala program. Currently, I am doing
I have a Java program that needs to call the same external executable 6
I have a fully-functional Java program that's fairly long, and I want to transfer
I'm working on a program that launches an applet that will demonstrate how the

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.