Bonjour à tous,
Eclipse fait la tronche quand je fait appel à la méthode addMergedRegion :
le message est : The method addMergedRegion(CellRangeAddress) in the type HSSFSheet is not applicable for the arguments (Region)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 package excel; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.util.Region; @SuppressWarnings("deprecation") public class CreationCelluleFusion { public static void main(String[] args) { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("ma feuille"); HSSFRow row = sheet.createRow(0); HSSFCell cell = null; cell = row.createCell((short) 0); cell.setCellValue(1234); Region region = new Region(0, (short) 0, 0, (short) 3); sheet.addMergedRegion(region); FileOutputStream fileOut; try { fileOut = new FileOutputStream("myExcelFile.xlsx"); wb.write(fileOut); fileOut.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
Merci d'avance pour vos aides![]()
Partager