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 6015463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:50:23+00:00 2026-05-23T02:50:23+00:00

I have a requirement to take the test data from Excel sheet and write

  • 0

I have a requirement to take the test data from Excel sheet and write test result as Pass/Fail in another Excel sheet.
I am using SeleniumRC+Java+Eclipse+Junit.

How can i change font color of text while writing to Excel sheet using Java.

I am doing with the help of Label, WorkBook, WrittableWorkbook, WrittableSheet, Sheet.

Here is my sample code..

import jxl.Sheet;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.read.biff.BiffException;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;

public class FinalTestSuite extends TestCase 
{
public static  File file = new File("C:/Selenium/selenium-remote-control-1.0.3/TestingResult.xls");
public static  File sourceFile = new File("C:/Selenium/selenium-remote-control-1.0.3/Portland.xls");
public static  WorkbookSettings ws;
public static  WritableWorkbook workbook;
public static  WritableSheet wSheet1, wSheet2;
public static  Sheet sh1, sh2;
public static  Sheet sheetFinal;
public static  Workbook sourceWorkbook;
public static  Label label;
}


public void getTestResult(String passOrfail) throws IOException,BiffException, WriteException

{
try
{

FinalTestSuite.file = new File("C:/Selenium/selenium-remote-control-1.0.3/TestingResult.xls");
FinalTestSuite.sourceFile = new File("C:/Selenium/selenium-remote-control-1.0.3/TestDetails.xls");
FinalTestSuite.ws = new WorkbookSettings();
FinalTestSuite.workbook = Workbook.createWorkbook(FinalTestSuite.file, FinalTestSuite.ws);
                FinalTestSuite.sourceWorkbook=Workbook.getWorkbook(FinalTestSuite.sourceFile);
FinalTestSuite.sh1 = FinalTestSuite.sourceWorkbook.getSheet(0);
FinalTestSuite.sh2= FinalTestSuite.sourceWorkbook.getSheet(1);
FinalTestSuite.wSheet1 = FinalTestSuite.workbook.importSheet("Begin", 0 , FinalTestSuite.sh1);
FinalTestSuite.wSheet2 = FinalTestSuite.workbook.importSheet("Reports", 0 , FinalTestSuite.sh2);
colCount = FinalTestSuite.wSheet2.getColumns();

rowCount = FinalTestSuite.wSheet2.getRows();

                for(col=1;col<=colCount;col++)
                {

                    for(row = 1;row<=rowCount;row++)
                    {
                        jxl.Cell dataCell =  FinalTestSuite.wSheet2.getCell(col, 0);

                        if(clientName.equals(client))
                        {
                            FinalTestSuite.label = new Label(col, row, passOrfail);
                            FinalTestSuite.wSheet2.addCell(FinalTestSuite.label);
                            break;                          


                        }

                    }
                }

        }
        catch(Exception e)
        {
             e.printStackTrace();
        } 

Please anybody tell me how can i modify it to get Test result with font color as red and green…

  • 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-23T02:50:23+00:00Added an answer on May 23, 2026 at 2:50 am

    Make use of WritableFont.setColour(Colour colour) when formatting the cell you’re writing to. See this tutorial for the basics. The API should be sufficient to know how to add a colour to the formatting examples available.

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

Sidebar

Related Questions

We have the requirement to take a form submission and save some data, then
i have a requirement, i want to take URL of image from user and
We have a requirement to increase the functionality of a grid we are using
I have a requirement to store the data in encrypted form in database tables.
I have a requirement at job to produce an Excel file and then to
We have a requirement in project to store all the revisions(Change History) for the
I have a requirement to make a large amount of code MISRA compliant. First
I have a requirement to be able to provide a flex component in English
I have a requirement to be be able to embed scanned tiff images into
I have a requirement to implement an Unsaved Changes prompt in an ASP .Net

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.