Amigos,
estou criando um relatório para exportar para Excel, como que faço fazer como q minha String ocupe 2 células do Excel ?
isso tanto para linha ou como coluna
row.createCell((short)0).setCellValue("DATA");
Amigos,
estou criando um relatório para exportar para Excel, como que faço fazer como q minha String ocupe 2 células do Excel ?
isso tanto para linha ou como coluna
row.createCell((short)0).setCellValue("DATA");
Thiago,
Faz assim
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Planilha");
HSSFRow row = sheet.createRow((short) 0);
HSSFCell cell = row.createCell((short) (0));
cell.setCellValue("Data");
Region r = new Region(0, (short)0, 0, (short)1);
sheet.addMergedRegion(r);
Robson,
deu certo ai estou montando o layout mas quando tento colocar alguma outro nome em uma célula do lado ele esta sobrepondo a minha String anterior
conforme abaixo
HSSFRow row = sheet.createRow((short) 0);//Linha
HSSFCell cell = row.createCell((short) (0));//Coluna
cell.setCellValue("Data");
Region r = new Region(0, (short)0, 1, (short)0);
sheet.addMergedRegion(r);
HSSFRow row2 = sheet.createRow((short) 0);//Linha
HSSFCell cell2 = row2.createCell((short) (1));//Coluna
cell2.setCellValue("Valores A");
r = new Region(1, (short)1, 1, (short)2);
sheet.addMergedRegion(r);
HSSFRow row3 = sheet.createRow((short) 0);//Linha
HSSFCell cell3 = row3.createCell((short) (3));//Coluna
cell3.setCellValue("Valores B");
Faz assim
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Planilha");
HSSFRow row = sheet.createRow((short) 0);
row.createCell((short) 0).setCellValue(new HSSFRichTextString("Data"));
Region r = new Region(0, (short)0, 1, (short)0);
sheet.addMergedRegion(r);
row.createCell((short) 1).setCellValue(new HSSFRichTextString("Valores A"));
r = new Region(0, (short)1, 0, (short)2);
sheet.addMergedRegion(r);
row.createCell((short) 4).setCellValue(new HSSFRichTextString("Valores B"));
r = new Region(0, (short)4, 0, (short)5);
sheet.addMergedRegion(r);
row.createCell((short) 7).setCellValue(new HSSFRichTextString("Diferença C"));
r = new Region(0, (short)7, 0, (short)9);
sheet.addMergedRegion(r);
Robson,
deu certo muito Obrigado
Thiago, coloca como resolvido…
Eu uso a biblioteca do JXL… eu ia te passar mas como vc estava seguindo outra linha… não quis atrapalhar seu raciocínio… se precisar avisa… flw