Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6882943
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:19:08+00:00 2026-05-27T05:19:08+00:00

I have error in line: workbook.write(); When I try debug, i see massage: Source

  • 0

I have error in line:

    workbook.write();

When I try debug, i see massage: “Source not found.”

How it fix?

    private void exportExcel() throws IOException, WriteException{

    File file = new File(Environment.getExternalStorageDirectory() + "/backup.xls");

    WritableWorkbook workbook = Workbook.createWorkbook(file);
    workbook.createSheet("worksheet", 0);

    workbook.write();
    workbook.close();
    }

Thanks in advance


WTF my code above begin to work!!!

When I started, I using default jexcelapi. Afterwards I begin using alternative jexcelapi, but it also not work.

When I try your code with little changes – it work! Your code:

    private void exportExcel() throws WriteException, IOException{

    File sdCard = Environment.getExternalStorageDirectory();
    File dir = new File(sdCard + "/myFolder");

    //make them in case they're not there
    dir.mkdirs();

    //create a standard java.io.File object for the Workbook to use
    File wbfile = new File(dir, "backup.xls");

    WritableWorkbook workbook = null;

    try{
      workbook = Workbook.createWorkbook(wbfile);
      workbook.createSheet("worksheet", 0);

      workbook.write();
      workbook.close();
    } catch (IOException ex) {
        Log.e("Workbook Test", "Could not create " + wbfile.getPath(), ex);
    }
}

But when I try my code above, it also work.

Maybe Eclipse not instantly update using library?

Thank you very much!

P.S. Excuse me for my bad english.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:19:09+00:00Added an answer on May 27, 2026 at 5:19 am

    Your code does not check that the external storage directory is actually available. You need to call getExternalStorageState and check the return value against the various MEDIA_* values defined in Environment. If the directory is not available, that may cause the problem.

    The problem also may be that you are trying to write to the root of the external storage directory. From the docs:

    Applications should not directly use this top-level directory, in order to avoid polluting the user’s root namespace. Any files that are private to the application should be placed in a directory returned by Context.getExternalFilesDir, which the system will take care of deleting if the application is uninstalled.

    EDIT

    Try this code:

    File sdCard = Environment.getExternalStorageDirectory();
    File dir = new File(sdCard + "/myFolder");
    
    //make them in case they're not there
    dir.mkdirs();
    
    //create a standard java.io.File object for the Workbook to use
    File wbfile = new File(dir, "backup.xls");
    
    try{
      WritableWorkbook workbook = Workbook.createWorkbook(wbfile);
      workbook.createSheet("worksheet", 0);
    
      workbook.write();
      workbook.close();
    } catch (IOException ex) {
      Log.e("Workbook Test", "Could not create " + wbfile.getPath(), ex);
    }
    return wb;
    

    That should tell you more about what’s going on.

    EDIT 2

    After a little more research, I found another possible issue: JExcelApi uses a lot of resources when it is creating a file. One solution is to use a temp file. Add the following code:

    WorkbookSettings wbSettings = new WorkbookSettings();
    wbSettings.setUseTemporaryFileDuringWrite(true);
    

    and inside the try block, change the line that creates the workbook:

    WritableWorkbook workbook = Workbook.createWorkbook(wbfile, wbSettings);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this error message: Msg 8134, Level 16, State 1, Line 1 Divide
I have 1 compiler error. It is from this line in my code: cout
I have a line of code that gets the following error when run through
In my program, I have been receiving an error when I use a command-line
i found a code but sometimes have error : StringBuilder strHeaders = new StringBuilder();
I have error at the first line of the following code while building with
In the following code i have error Uncaught SyntaxError: Unexpected token ; in line
Hi folks I have the following error on line 11 in this controller code
I have The Following Javascript Error Line 2 Character 1 coming in the entire
In my application I want to translate the validation error line: 3 errors have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.