Bonjour,

j'utilise l'API java JXL pour extraire des données dans un fichier Excel,

j'arrive pas à bien à le faire mais j'a un doc Excel sans nom des colonnes :
J'aimerais bien avoir une première ligne avec Nom des colonnes et permettant un filtre si possible.


mon code actuel est comme suivant :

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
	//Excel File
			WritableWorkbook workbook = Workbook.createWorkbook(localByteArrayOutputStream);
 
			//Sheet
			WritableSheet sheet = workbook.createSheet("Extraction des appels", 0); 
 
			//TODO Begin Code de Test
 
//			//Here check write Data in Excel file
			//Format dune cellule
			WritableFont arial10font = new WritableFont(WritableFont.ARIAL, 20,WritableFont.BOLD, true, UnderlineStyle.NO_UNDERLINE,Colour.BLUE, ScriptStyle.NORMAL_SCRIPT); 
			WritableCellFormat arial10format = new WritableCellFormat(arial10font); 
 
			//Crée un label à la ligne 0, colonne 0 avec le format spécifique 
			//Label label = new Label(0, 0, "Arial 10 point label",arial10format); 
 
			for(int i = 0; i < eventsDetailsList.length; i++) {
 
				ReadModel eventData = eventsDetailsList[i];
				//Crée des labels à la ligne 1, les valeurs qui varient = colonnes
				Label label_0 = new Label(0,i,eventData.getPropertyValue("ORIG_START").toString()); 
				Label label_1 = new Label(1,i,eventData.getPropertyValue("CALLEDPARTY").toString()); 
				Label label_2 = new Label(2,i,eventData.getPropertyValue("EXT_RATED_VOLUME").toString()); 
				Label label_3 = new Label(3,i,eventData.getPropertyValue("RATED_FLAT_AMOUNT").toString()); 
 
 
				//Ajout des cellules 
				sheet.addCell(label_0);
				sheet.addCell(label_1);
				sheet.addCell(label_2);
				sheet.addCell(label_3);
 
			}
 
 
 
 
			//TODO ENd code de Test
			// All sheets and cells added. Now write out the workbook 
 
			workbook.write(); 
			workbook.close();