https://issues.apache.org/bugzilla/show_bug.cgi?id=51321
Bug #: 51321
Summary: XSSFCell.setCellValue should not strip off ending
spaces
Product: POI
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: critical
Priority: P2
Component: XSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Created attachment 27106
--> https://issues.apache.org/bugzilla/attachment.cgi?id=27106
java code to reproduce the setCellValue bug in XSSFCell.java
I am creating a xlsx file with only two cells. One cell is created with value
"ABC " and the other cell is created with value "ABC ". Please note that
the second cell differs from the first cell only with more ending spaces.
However, in the generated xlsx file, both cells are populated with value "ABC
".
I believe the setCellValue method in XSSFCell.java has a bug. Perhaps it was
using a pre-evaluated result string incorrectly in this case.
Please see the attached code to reproduce this problem.
package org.apache.poi.ss.examples;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
import java.io.FileOutputStream;
public class XSSFSetValueBug {
public static void main(String[] args) throws Exception {
Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook();
Sheet sheet = wb.createSheet("sheet1");
CreationHelper createHelper = wb.getCreationHelper();
Cell cell0 = sheet.createRow(0).createCell(0);
cell0.setCellValue(createHelper.createRichTextString("ABC "));
Cell cell1 = sheet.createRow(1).createCell(0);
cell1.setCellValue(createHelper.createRichTextString("ABC "));
// Write the output to a file
FileOutputStream fileOut = new
FileOutputStream("C:\\workspace\\TestXSSFSetValueBug.xlsx");
wb.write(fileOut);
fileOut.close();
}
}
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]