title: Problem in creating spreadsheet(xls) file
body: <p>I am creating an <code>.xls</code>-file using following code. i have got reference from <a href="http://www.vogella.de/articles/JavaExcel/article.html" rel="nofollow">http://www.vogella.de/articles/JavaExcel/article.html</a> and  <a href="http://www.andykhan.com/jexcelapi/tutorial.html" rel="nofollow">http://www.andykhan.com/jexcelapi/tutorial.html</a> Please suggest solution or alternate way to do this.</p>
  
  <p>below is the code</p>
  
  <pre><code>String filename = "SpreadsheetTest.xls";
  File root = Environment.getExternalStorageDirectory();
  
  WorkbookSettings wbSettings = new WorkbookSettings();
  wbSettings.setLocale(new Locale("en", "EN"));
  
  WritableWorkbook workbook = Workbook.createWorkbook(new File(root, filename), wbSettings);
  WritableSheet sheet = workbook.createSheet("First Sheet", 0); 
  
  Label label = new Label(0, 2, "A label record"); 
  sheet.addCell(label); 
  
  Number number = new Number(3, 4, 3.1459); 
  sheet.addCell(number); 
  
  workbook.write(); 
  workbook.close();
  </code></pre>
  
  <p>The above code is giving <code>NullPointerException</code>:</p>
  
  <pre><code>08-19 14:34:46.354: ERROR/AndroidRuntime(3298): Uncaught handler: thread main exiting due to uncaught exception
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.spreadsheet/com.spreadsheet.MainScreen}: java.lang.NullPointerException
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.app.ActivityThread.access$2200(ActivityThread.java:119)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.os.Handler.dispatchMessage(Handler.java:99)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.os.Looper.loop(Looper.java:123)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.app.ActivityThread.main(ActivityThread.java:4363)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at java.lang.reflect.Method.invokeNative(Native Method)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at java.lang.reflect.Method.invoke(Method.java:521)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at dalvik.system.NativeStart.main(Native Method)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298): Caused by: java.lang.NullPointerException
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at jxl.biff.StringHelper.getUnicodeBytes(StringHelper.java:141)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at jxl.biff.FontRecord.getData(FontRecord.java:289)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at jxl.biff.WritableRecordData.getBytes(WritableRecordData.java:71)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at jxl.write.biff.File.write(File.java:147)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at jxl.biff.Fonts.write(Fonts.java:110)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at jxl.write.biff.WritableWorkbookImpl.write(WritableWorkbookImpl.java:821)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at com.spreadsheet.MainScreen.onCreate(MainScreen.java:59)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
  08-19 14:34:46.362: ERROR/AndroidRuntime(3298):     ... 11 more
  </code></pre>
  
  <p>Please guide me to solve this issue. Please suggest me any alternate way to generate xls file if any.</p>