我正在尝试使用apache poi做这样的事情 .
但我的代码正在创建这个 .
我怎么能跳线?这是我的代码,我不知道我是否采取了正确的方式 . 我只需要像第一张图片一样 . 我希望你帮助我,谢谢:)
InputStream is = new FileInputStream("C:/logomenor.png");
byte[] bytes = IOUtils.toByteArray(is);
int pictureIdx = workbook.addPicture(bytes, XSSFWorkbook.PICTURE_TYPE_PNG);
is.close();
CreationHelper helper = sheetEtiquetas.getWorkbook().getCreationHelper();
Drawing drawing = sheetEtiquetas.createDrawingPatriarch();
ClientAnchor anchor = helper.createClientAnchor();
anchor.setAnchorType(ClientAnchor.MOVE_AND_RESIZE);
for (int i = 0; i < array.size(); i++) {
int cont = 0;
int cellnum = 0;
anchor.setCol1(0); //first anchor determines upper left position
anchor.setRow1(cont);
anchor.setRow2(i); //second anchor determines bottom right position
anchor.setCol2(cont);
anchor.setDx2(Units.toEMU(148)); //dx = left + wanted width
anchor.setDy2(Units.toEMU(30));
sheetEtiquetas.setColumnWidth(0, 10000);
sheetEtiquetas.setColumnWidth(1, 13000);
Row row = sheetEtiquetas.createRow(rownum++);
sheetEtiquetas.autoSizeColumn(1);
Cell cellTexto = row.createCell(cellnum++);
drawing.createPicture(anchor, pictureIdx);
cellTexto.setCellValue("Controle Dinâmico");
cellTexto.setCellStyle(styleNegrito);
Cell cellCliente = row.createCell(cellnum++);
cellCliente.setCellValue(" Cliente: " + array.get(i).getCliente());
cellCliente.setCellStyle(style);
row = sheetEtiquetas.createRow(rownum++);
cellnum = 0;
Cell cellOp = row.createCell(cellnum++);
cellOp.setCellValue("Número O.P: " + array.get(i).getNumeroOP());
cellOp.setCellStyle(style);
Cell cellNomeItem = row.createCell(cellnum++);
cellNomeItem.setCellValue("Código da Peça: " + array.get(i).getNomeItem());
cellNomeItem.setCellStyle(style);
// Alinha a esquerda
row = sheetEtiquetas.createRow(rownum++);
cellnum = 0;
Cell cellPedido = row.createCell(cellnum++);
cellPedido.setCellValue("Número do Pedido: " + array.get(i).getNumeroPedido());
cellPedido.setCellStyle(style);
Cell cellQuantidade = row.createCell(cellnum++);
cellQuantidade.setCellValue("Quantidade: " + array.get(i).getQuantidade());
cellQuantidade.setCellStyle(style);
rownum++;