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

The Archive Base Latest Questions

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

The following is my java code for reading a excel sheet content. String urlcnt=;

  • 0

The following is my java code for reading a excel sheet content.

String urlcnt="";
for (Row row : sheet) {
 {
Cell firstCell = row.getCell(0);
urlcnt=firstCell.getRichStringCellValue();}

While compiling the above code am getting the following error.

ReadExcel.java:18: incompatible types
found   : org.apache.poi.ss.usermodel.RichTextString required: java.lang.String
                    urlcnt=firstCell.getRichStringCellValue();//This line is the cause for the error

Instead of storing the getRichStringCellValue() in a string, if I just print the value of the cell, it works fine. But I go ahead and store it in a string for further processing the problem occurs.

Kindly let me know what has to be done to proceeed.

  • 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-16T20:26:43+00:00Added an answer on May 16, 2026 at 8:26 pm

    The error is because getRichStringCellValue() returns a HSSFRichTextString or XSSFRichTextString (depending on whether your cell is HSSFCell or XSSFCell) and you are assigning it to a String

    Depending on your further processing –

    Do you want to call applyFont or clearFormatting on the HSSFRichTextString ?
    then store it in a HSSFRichTextString/XSSFRichTextString.

    If you actually want only the String text, use the getString() method from the POI API

    UPDATE as per your comments

    Use it as

    urlcnt=firstCell.getRichStringCellValue().getString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am having a problem reading/parsing the following JSON string in Java. Code: try{ json
The following Java code is throwing a compiler error: if ( checkGameTitle(currGame) ) ArrayList<String>
I am reading some Java text and got the following code: int[] a =
I am reading the java tutorial about Wildcards in Generics. In the following code:
Reading this DZone article about Java concurrency I was wondering if the following code:
After reading: Getting the 'external' IP address in Java code: public static void main(String[]
Using the following code while reading in a .xls file, where s is the
I have to write a code in JAVA like following structure: Read String From
The following java code prints Hello World on my co-worker's computer: public void testJDBC()
I have the following java code: import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;

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.