ASF Bugzilla – Attachment 31022 Details for
Bug 55752
Using RegionUtil will result merged cell turn black when clicked in
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
Sample to show this bug.
Test.java (text/plain), 1.63 KB, created by
btpka3
on 2013-11-07 03:15:25 UTC
(
hide
)
Description:
Sample to show this bug.
Filename:
MIME Type:
Creator:
btpka3
Created:
2013-11-07 03:15:25 UTC
Size:
1.63 KB
patch
obsolete
>import java.io.File; >import java.io.FileOutputStream; > >import org.apache.poi.ss.usermodel.Cell; >import org.apache.poi.ss.usermodel.CellStyle; >import org.apache.poi.ss.usermodel.Row; >import org.apache.poi.ss.usermodel.Sheet; >import org.apache.poi.ss.usermodel.Workbook; >import org.apache.poi.ss.util.CellRangeAddress; >import org.apache.poi.ss.util.RegionUtil; >import org.apache.poi.xssf.usermodel.XSSFWorkbook; > > > >public class Test { > > public static void main(String[] args) throws Exception { > > Workbook wb = new XSSFWorkbook(); > Sheet sheet = wb.createSheet("test"); > > for (int i = 0; i < 2; i++) { > Row row = sheet.createRow(i); > for (int j = 0; j < 2; j++) { > Cell cell = row.createCell(j); > cell.setCellStyle(wb.createCellStyle()); > } > } > > // set content > Row row1 = sheet.getRow(0); > row1.getCell(0).setCellValue("AAA"); > Row row2 = sheet.getRow(1); > row2.getCell(0).setCellValue("BBB"); > > // merge cells > CellRangeAddress range1 = new CellRangeAddress(0, 0, 0, 1); > sheet.addMergedRegion(range1); > CellRangeAddress range2 = new CellRangeAddress(1, 1, 0, 1); > sheet.addMergedRegion(range2); > > // set border > RegionUtil.setBorderBottom(CellStyle.BORDER_THIN, range1, sheet, wb); > row2.getCell(0).getCellStyle().setBorderBottom(CellStyle.BORDER_THIN); > row2.getCell(1).getCellStyle().setBorderBottom(CellStyle.BORDER_THIN); > > // write to file > wb.write(new FileOutputStream(new File("C:/test.xlsx"))); > } > >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 55752
: 31022 |
33069