Bonjour,

J'aimerai copier une sheet vers un autre workbook, après de multiples recherche j'ai cru comprendre que la version 2.6.12 de jexcelapi ne supportait pas cette fonction, je suis donc revenu à la version 2.6.10. Tout fonctionnait correctement, mais soudain j'obtiens une erreur :

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
java.lang.StringIndexOutOfBoundsException: length=0; index=1
     at jxl.biff.EncodedURLHelper.getFile(EncodedURLHelper.java:60)
     at jxl.biff.EncodedURLHelper.getEncodedURL(EncodedURLHelper.java:51)
     at jxl.write.biff.SupbookRecord.initExternal(SupbookRecord.java:203)
     at jxl.write.biff.SupbookRecord.getData(SupbookRecord.java:254)
     at jxl.biff.WritableRecordData.getBytes(WritableRecordData.java:71)
     at jxl.write.biff.File.write(File.java:147)
     at jxl.write.biff.WritableWorkbookImpl.write(WritableWorkbookImpl.java:913)
     at com.mycoprod.akhetib.mycoprod.MainActivity.createExcel(MainActivity.java:172)
     at com.mycoprod.akhetib.mycoprod.MainActivity.access$100(MainActivity.java:26)
     at com.mycoprod.akhetib.mycoprod.MainActivity$1.onClick(MainActivity.java:64)
     at android.view.View.performClick(View.java:4475)
     at android.view.View$PerformClick.run(View.java:18786)
     at android.os.Handler.handleCallback(Handler.java:730)
     at android.os.Handler.dispatchMessage(Handler.java:92)
     at android.os.Looper.loop(Looper.java:176)
     at android.app.ActivityThread.main(ActivityThread.java:5419)
     at java.lang.reflect.Method.invokeNative(Native Method)
     at java.lang.reflect.Method.invoke(Method.java:525)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
     at dalvik.system.NativeStart.main(Native Method)
voici mon code :

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
 
File outFile = new File(getExternalFilesDir(null), "Diffusion_2016_v2_" + titleFile);
                            AssetManager am = getAssets();
                            InputStream xlsRefStream = am.open("Diffusion_2016_v2.xls");
                            Workbook refWorkbook = Workbook.getWorkbook(xlsRefStream);
                            WritableWorkbook copy = Workbook.createWorkbook(outFile, refWorkbook);
 
                            //Rename de sheet name and Week number cell
                            WritableSheet sourceSheet = copy.getSheet(0);
                            Label labelDate = new Label(5, 0, "Semaine "+dDate);
                            sourceSheet.addCell(labelDate);
                            //Sheet Name
                            sourceSheet.setName("S"+dDate);
 
                            copy.write();
                            copy.close();
 
                            System.out.println("Création du fichier Diffusion_2016_v2_" + titleFile + " !");
Que quelqu'un me vienne en aide, please