https://issues.apache.org/bugzilla/show_bug.cgi?id=51554
Bug #: 51554
Summary: autoSizeColumn sets column width too small for some
capital letters
Product: POI
Version: 3.8-dev
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Classification: Unclassified
Using version 3.7 and 3.8-beta3
HSSFSheet.autoSizeColumn calculates the size of a column with capital letters
too small. Unfortunately, the test is visual. With the test below, notice how
the "TEST" and "HIPS" columns are too small.
To reproduce:
import org.apache.poi.hssf.usermodel.*;
import java.io.*;
public class AutoSizeTest {
public static void main(String args[]) {
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet();
HSSFRow row = sheet.createRow(0);
HSSFCell cell0 = row.createCell(0);
HSSFCell cell1 = row.createCell(1);
HSSFCell cell2 = row.createCell(2);
HSSFCell cell3 = row.createCell(3);
HSSFCell cell4 = row.createCell(4);
cell0.setCellValue("TEST");
cell1.setCellValue("test");
cell2.setCellValue("ZZZZ");
cell3.setCellValue("zzzz");
cell4.setCellValue("HIPS");
sheet.autoSizeColumn(0);
sheet.autoSizeColumn(1);
sheet.autoSizeColumn(2);
sheet.autoSizeColumn(3);
sheet.autoSizeColumn(4);
try {
FileOutputStream out = new FileOutputStream("working.xls");
workbook.write(out);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
} // main
}
--
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]