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: [email protected]
For additional commands, e-mail: [email protected]