You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Aruna <so...@gmail.com> on 2014/01/13 17:55:04 UTC

Unable to read the fully formatted text from XSSF

Hi,

I am trying to read the rich text string from .xlsx file using XSSF. But
when the first character of cell is formatted (bold/underline/italic), cell
is not reading in richtextformat. Please help me in this.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Could you please provide me an example. I want to append 2 rich text strings
without disturbing its given formats.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714680.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by 山本 亮 <ry...@yjk.co.jp>.
You can use XSSFRichTextString#append(java.lang.String text, XSSFFont font) method to append a string to a rich text.

http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFRichTextString.html#append(java.lang.String, org.apache.poi.xssf.usermodel.XSSFFont)

Ryo Yamamoto


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Thank you. I will check the differences. Meanwhile, could you please help me
in appending 2 XSSFRichTextStrings. Once XSSFRichTextString from .xlsx file,
which is holding some text format. And the other String is appending
locally.

I am reading text from cell of an .xlsx file. 
POI version: 3.10 
Now I want to append a string to the rich text read from the cell without
loosing the fonts applied to the text in cell [either cell level or the
string level]. Please help. 

Below is the code snippet I have tried: 

                File fis = new File(filePathName); 
                XSSFWorkbook workbook = new
XSSFWorkbook(fis.getAbsolutePath()); 
            XSSFSheet sheet = workbook.getSheetAt(0); 

                OPCPackage opcPackage =
OPCPackage.open(fis.getAbsolutePath()); 
                XSSFWorkbook wb = new XSSFWorkbook(opcPackage); 
                CellReference cellReference = new CellReference(cellName); 
                XSSFRow row = sheet.getRow(cellReference.getRow()); 
                XSSFCell cell = row.getCell(cellReference.getCol()); 

                XSSFRichTextString cellText = cell.getRichStringCellValue(); 
       
System.out.println(cell.getRichStringCellValue().getFontAtIndex(0).getBold());
// true 
        XSSFRichTextString cellText1 = new XSSFRichTextString("a"); 
        XSSFRichTextString s3 = new XSSFRichTextString(cellText.getString()
+ cellText1.getString()); 
        
        cell.setCellValue(s3); 
        XSSFRichTextString cellText2 = cell.getRichStringCellValue(); 
        System.out.println(cellText2.getFontAtIndex(0).getItalic()); //
throwing null pointer exception 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714678.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Nick Burch <ap...@gagravarr.org>.
On Wed, 15 Jan 2014, Aruna wrote:
> So, it seems the issue is not with the POI code, the issue is with .xlsx 
> file. Any suggestions please... to resolve this.

.xlsx is a zip of xml files, in a defined structure

So, try unzipping both a working and not-working file, and diff the xml 
files, to try to see how they differ

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
HI

I am not running my code in different platforms. I just created an .xlsx
file in Windows machine and copied the same into Ubuntu Linux machine. Then,
its working fine. But, when I open the same file (which is created in
Windows machine) in my Ubuntu Linux machine and modify something then saved,
its not working properly.

Note: Running the code in Ubuntu Linux machine only. Only .xlsx files are
different.

So, it seems the issue is not with the POI code, the issue is with .xlsx
file. Any suggestions please... to resolve this.

Thanks,



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714676.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Nick Burch <ap...@gagravarr.org>.
On Wed, 15 Jan 2014, Aruna wrote:
> Finally, I got to know, the issue, its because i am using Ubuntu OS. 
> When I create a .xlsx file in Windows machine and access that file in my 
> Ubuntu, then it is working fine. But, when I created .xlsx in Ubuntu, it 
> not working properly.

There shouldn't be any differences - POI is cross platform. I can only 
suggest you ensure you're really running the same code on both machines, 
and have the same POI jars (and no older ones!) on your classpath

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Finally, I got to know, the issue, its because i am using Ubuntu OS. When I
create a .xlsx file in Windows machine and access that file in my Ubuntu,
then it is working fine. But, when I created .xlsx in Ubuntu, it not working
properly. Is there any way to resolve this issue. Or else, plz provide me
the alternative.

Thanks,
Aruna.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714671.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Thank u

Can u plz help me in reading this file. I want to get the font at all the
indexes.
Test3.xlsx
<http://apache-poi.1045710.n5.nabble.com/file/n5714662/Test3.xlsx>  
The example given by u is for set the cell type. I want to read from .xlsx
file.

A1 is having : img0 where "i" is bold, "m" is bold and underline, "g" is
bold and italic, "0" is bold and italic.

I am trying like this:

CellReference b1 = new CellReference("A1");
    	  XSSFRow b1Row = sheet.getRow(b1.getRow());
    	  XSSFCell b1Cell = b1Row.getCell(b1.getCol());
    	  XSSFRichTextString value = b1Cell.getRichStringCellValue();
    	  XSSFFont b1Font = value.getFontAtIndex(1); // return true
    	  
    	  System.out.println(b1Font.getBold()); 
    	  XSSFFont b1Font1 = value.getFontAtIndex(0);// throwing null pointer
exception Test3.xlsx
<http://apache-poi.1045710.n5.nabble.com/file/n5714662/Test3.xlsx>   
    	  System.out.println(b1Font1.getBold()); 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714662.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
I am using poi 3.8 & jre 1.6

attached my file.

code:

         File fis = new File(filePathName);
        OPCPackage opcPackage = OPCPackage.open(fis.getAbsolutePath());
        XSSFWorkbook wb = new XSSFWorkbook(opcPackage);
        XSSFSheet sheet = wb.getSheetAt(0);
        CellReference cellReference = new CellReference(cellName);
        XSSFRow row = sheet.getRow(cellReference.getRow());
        XSSFCell cell = row.getCell(cellReference.getCol());
        XSSFRichTextString cellText1 = new XSSFRichTextString();
        cellText1 = cell.getRichStringCellValue();
        System.out.println(cellText1.numFormattingRuns()); // returns 0
System.out.println(cell.getRichStringCellValue().numFormattingRuns()); //
returns 0 Test3.xlsx
<http://apache-poi.1045710.n5.nabble.com/file/n5714652/Test3.xlsx>  



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714652.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Thank u

Can u plz help me in reading this file. I want to get the font at all the
indexes.

The example given by u is for set the cell type. I want to read from .xlsx
file. Test3.xlsx
<http://apache-poi.1045710.n5.nabble.com/file/n5714661/Test3.xlsx>  



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714661.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by 山本 亮 <ry...@yjk.co.jp>.
Example code for your XLSX file, Test6.xlsx.

  File fis = new File("/path/to/Test6.xlsx");
  OPCPackage opcPackage = OPCPackage.open(fis.getAbsolutePath());
  XSSFWorkbook wookbook = new XSSFWorkbook(opcPackage);
  XSSFSheet sheet = wookbook.getSheetAt(0);

  CellReference a1 = new CellReference("A1");
  XSSFCell a1Cell = sheet.getRow(a1.getRow()).getCell(a1.getCol());

  // "Hello" has formatting applied at the cell level.
  XSSFCellStyle a1Style = a1Cell.getCellStyle();
  XSSFFont a1Font = wookbook.getFontAt(a1Style.getFontIndex());
  System.out.println(a1Font.getBold());    // true
  System.out.println(a1Font.getItalic());  // true

  // "World" has formatting applied at the rich text string level.
  XSSFRichTextString value = a1Cell.getRichStringCellValue();
  XSSFFont rtfFont = value.getFontAtIndex(7);
  System.out.println(rtfFont.getBold());   // false
  System.out.println(rtfFont.getItalic()); // false

Ryo Yamamoto

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by 山本 亮 <ry...@yjk.co.jp>.
Because Cell A1 doesn't have formatting applied at the rich text string level.

> Then, i got an error here.
> CellReference b1 = new CellReference("A1");
> XSSFRow b1Row = sheet.getRow(b1.getRow());
> XSSFCell b1Cell = b1Row.getCell(b1.getCol());
> XSSFRichTextString value = b1Cell.getRichStringCellValue();
> XSSFFont b1Font = value.getFontAtIndex(0);
> System.out.println(b1Font.getBold()); //null pointer exception

Cell A1("img0") has formatting applied at the cell level.  Cell B1(" Hello Script...working properly1") has formatting applied at the rich text string level.

See the API doc for details. http://poi.apache.org/apidocs/org/apache/poi/xssf/usermodel/XSSFRichTextString.html

Ryo Yamamoto

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
HI

I am using Ubuntu machine. Saving files in Ubuntu machine only. Is XSSF is
platform dependent? Its is working fine when I created the .xlsx file in
Windows machine. 

Please reply me at the earliest


The first lines of code is working fine for me.

XSSFFont a1Font = wb.getFontAt(a1Style.getFontIndex());
    	 
System.out.println(a1Cell.getRichStringCellValue().numFormattingRuns());
    	  System.out.println(a1Font.getUnderline()); // 1
    	  System.out.println(a1Font.getBold());      // true
    	  System.out.println(a1Font.getItalic());    // true

Then, i got an error here.
CellReference b1 = new CellReference("A1");
    	  XSSFRow b1Row = sheet.getRow(b1.getRow());
    	  XSSFCell b1Cell = b1Row.getCell(b1.getCol());
    	  XSSFRichTextString value = b1Cell.getRichStringCellValue();
    	  XSSFFont b1Font = value.getFontAtIndex(0);
    	  System.out.println(b1Font.getBold()); //null pointer exception




--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714657.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by 山本 亮 <ry...@yjk.co.jp>.
I think you assigned bold/italic/underline not to RichTextString but to CellStyle(See the code below).

  File fis = new File("/path/to/Test3.xlsx");
  OPCPackage opcPackage = OPCPackage.open(fis.getAbsolutePath());
  XSSFWorkbook wookbook = new XSSFWorkbook(opcPackage);
  XSSFSheet sheet = wookbook.getSheetAt(0);

  CellReference a1 = new CellReference("A1");
  XSSFCell a1Cell = sheet.getRow(a1.getRow()).getCell(a1.getCol());
  XSSFCellStyle a1Style = a1Cell.getCellStyle();
  XSSFFont a1Font = wookbook.getFontAt(a1Style.getFontIndex());
  System.out.println(a1Font.getUnderline()); // 1
  System.out.println(a1Font.getBold());      // true
  System.out.println(a1Font.getItalic());    // true

  CellReference b1 = new CellReference("B1");
  XSSFRow b1Row = sheet.getRow(b1.getRow());
  XSSFCell b1Cell = b1Row.getCell(b1.getCol());
  XSSFRichTextString value = b1Cell.getRichStringCellValue();
  XSSFFont b1Font = value.getFontAtIndex(6);
  System.out.println(b1Font.getBold());      // true


Ryo Yamamoto

-----Original Message-----
From: Aruna [mailto:soft.aruna@gmail.com] 
Sent: Wednesday, January 15, 2014 1:52 PM
To: user@poi.apache.org
Subject: RE: Unable to read the fully formatted text from XSSF


Hi

I have tried the same example given by u. I was using POI 3.8 before. I changed my jar from 3.8 to 3.9. Still same issue.

Please help me...its urgent

Attached my .xlsx file also. Test6.xlsx
<http://apache-poi.1045710.n5.nabble.com/file/n5714654/Test6.xlsx>  

 try  {
        File fis = new File(filePathName);
        InputStream in = new FileInputStream(fis);
            XSSFWorkbook workbook = new XSSFWorkbook(in);
            XSSFSheet sheet = workbook.getSheetAt(0);
            XSSFRow row = sheet.getRow(0);
            XSSFCell cell = row.getCell(0);
            XSSFRichTextString value = cell.getRichStringCellValue();   //
value is not null
             
             //Hello World is bold and italic

            System.out.println(value.getString());                      //
Hello, World!
            System.out.println(value.getString().charAt(0));            // H
            System.out.println(value.getFontAtIndex(0).getBold());      //
throwing null pointer exception
           
          } 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714654.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Hi

I have tried the same example given by u. I was using POI 3.8 before. I
changed my jar from 3.8 to 3.9. Still same issue.

Please help me...its urgent

Attached my .xlsx file also. Test6.xlsx
<http://apache-poi.1045710.n5.nabble.com/file/n5714654/Test6.xlsx>  

 try  {
        File fis = new File(filePathName);
        InputStream in = new FileInputStream(fis);
            XSSFWorkbook workbook = new XSSFWorkbook(in);
            XSSFSheet sheet = workbook.getSheetAt(0);
            XSSFRow row = sheet.getRow(0);
            XSSFCell cell = row.getCell(0);
            XSSFRichTextString value = cell.getRichStringCellValue();   //
value is not null
             
             //Hello World is bold and italic

            System.out.println(value.getString());                      //
Hello, World!
            System.out.println(value.getString().charAt(0));            // H
            System.out.println(value.getFontAtIndex(0).getBold());      //
throwing null pointer exception
           
          } 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714654.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Hi

I have tried the same example given by u. I was using POI 3.8 before. I
changed my jar from 3.8 to 3.9. Still same issue.

Please help me...its urgent

 try  {
        	File fis = new File(filePathName);
        	InputStream in = new FileInputStream(fis);
            XSSFWorkbook workbook = new XSSFWorkbook(in);
            XSSFSheet sheet = workbook.getSheetAt(0);
            XSSFRow row = sheet.getRow(0);
            XSSFCell cell = row.getCell(0);
            XSSFRichTextString value = cell.getRichStringCellValue();   //
value is not null
             
             //Hello World is bold and italic

            System.out.println(value.getString());                      //
Hello, World!
            System.out.println(value.getString().charAt(0));            // H
            System.out.println(value.getFontAtIndex(0).getBold());      //
throwing null pointer exception
            
          }



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714653.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by 山本 亮 <ry...@yjk.co.jp>.
I also tried to read from an xlsx file, but the result looks fine.

  try (InputStream in = Files.newInputStream(Paths.get("/path/to/RichText.xlsx"))) {
    XSSFWorkbook workbook = new XSSFWorkbook(in);
    XSSFSheet sheet = workbook.getSheetAt(0);
    XSSFRow row = sheet.getRow(0);
    XSSFCell cell = row.getCell(0);
    XSSFRichTextString value = cell.getRichStringCellValue();   // value is not null

    System.out.println(value.getString());                      // Hello, World!
    System.out.println(value.getString().charAt(0));            // H
    System.out.println(value.getFontAtIndex(0).getBold());      // true
    System.out.println(value.getFontAtIndex(0).getItalic());    // true
    System.out.println(value.getFontAtIndex(0).getUnderline()); // 1
    System.out.println(value.getString().charAt(1));            // e
    System.out.println(value.getFontAtIndex(1).getBold());      // false
    System.out.println(value.getFontAtIndex(1).getItalic());    // false
    System.out.println(value.getFontAtIndex(1).getUnderline()); // 0
  }

Well, could you give me the file that fails to read?

Ryo Yamamoto

-----Original Message-----
From: Aruna [mailto:soft.aruna@gmail.com] 
Sent: Tuesday, January 14, 2014 4:12 PM
To: user@poi.apache.org
Subject: RE: Unable to read the fully formatted text from XSSF


Hi,

Thanks for your reply. The example given by you is working correctly. But, when I am trying to fetch the cell data, if the cell data is "Hello World"
and "H" is not aligned with bold/italic/underline, i am able to get the rich text string. But when "H" is bold/italic/underline, its returning null. 

System.out.println(cell.getRichStringCellValue().getFontAtIndex(0));

the issue only when the cell is read from the .xlsx file. 

Please help me to resolve this issue.

Thanks,



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714631.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by Aruna <so...@gmail.com>.
Hi,

Thanks for your reply. The example given by you is working correctly. But,
when I am trying to fetch the cell data, if the cell data is "Hello World"
and "H" is not aligned with bold/italic/underline, i am able to get the rich
text string. But when "H" is bold/italic/underline, its returning null. 

System.out.println(cell.getRichStringCellValue().getFontAtIndex(0));

the issue only when the cell is read from the .xlsx file. 

Please help me to resolve this issue.

Thanks,



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625p5714631.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


RE: Unable to read the fully formatted text from XSSF

Posted by 山本 亮 <ry...@yjk.co.jp>.
I wrote the sample code below with POI 3.9.

        XSSFWorkbook workbook = new XSSFWorkbook();
        XSSFSheet sheet = workbook.createSheet();
        XSSFRow row = sheet.createRow(0);
        XSSFCell cell = row.createCell(0);

        Font defaultFont = workbook.createFont();

        Font formattedFont = workbook.createFont();
        formattedFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        formattedFont.setItalic(true);
        formattedFont.setUnderline((byte) 1);

        XSSFRichTextString richtext = new XSSFRichTextString("Hello, World!");
        richtext.applyFont(0, 1, formattedFont); // format the first charactor of cell
        richtext.applyFont(1, richtext.length(), defaultFont);
        cell.setCellValue(richtext);

        System.out.println(cell.getRichStringCellValue().getString());                      // Hello, World!
        System.out.println(cell.getRichStringCellValue().getString().charAt(0));            // H
        System.out.println(cell.getRichStringCellValue().getFontAtIndex(0).getBold());      // true
        System.out.println(cell.getRichStringCellValue().getFontAtIndex(0).getItalic());    // true
        System.out.println(cell.getRichStringCellValue().getFontAtIndex(0).getUnderline()); // 1
        System.out.println(cell.getRichStringCellValue().getString().charAt(1));            // e
        System.out.println(cell.getRichStringCellValue().getFontAtIndex(1).getBold());      // false
        System.out.println(cell.getRichStringCellValue().getFontAtIndex(1).getItalic());    // false
        System.out.println(cell.getRichStringCellValue().getFontAtIndex(1).getUnderline()); // 0

When I run the above code, it seems that getRichStringCellValue method returns XSSFRichTextString correctly.

Ryo Yamamoto

-----Original Message-----
From: Aruna [mailto:soft.aruna@gmail.com] 
Sent: Tuesday, January 14, 2014 1:55 AM
To: user@poi.apache.org
Subject: Unable to read the fully formatted text from XSSF

Hi,

I am trying to read the rich text string from .xlsx file using XSSF. But when the first character of cell is formatted (bold/underline/italic), cell is not reading in richtextformat. Please help me in this.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Unable-to-read-the-fully-formatted-text-from-XSSF-tp5714625.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org