https://issues.apache.org/bugzilla/show_bug.cgi?id=54894
Bug ID: 54894
Summary: Cell gets corrupted after calling cloneStyleFrom and
setBorderBottom
Product: POI
Version: 3.9
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
In the code below the cell gets corrupted when we call setCellStyle on it after
calling cloneStyleFrom and setBorderBottom.In the generated file right click on
the cell to which the style was applied to notice that the "Format cells "
dialog doesnot come up.
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.*;
import java.io.FileOutputStream;
import java.io.IOException;
/**
* Demonstrates how to create borders around cells.
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public class Borders
{
public static void main(String[] args)
throws IOException
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
// Create a row and put some cells in it. Rows are 0 based.
HSSFRow row = sheet.createRow((short) 1);
// Create a cell and put a value in it.
HSSFCell cell = row.createCell((short) 1);
cell.setCellValue(4);
CellStyle def = cell.getCellStyle();
// Style the cell with borders all around.
HSSFCellStyle style = wb.createCellStyle();
style.cloneStyleFrom(def);
style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cell.setCellStyle(style);
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
}
}
--
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]