Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Open a new worksheet using jExcel

 
Kalai Selvi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create and open a new excel workbook from java program. I am using JExcel API.
I use

Writableworkbook = Workbook.createWorkbook(new File("fileformat.xls"));

fileformat.xls is the name of the file i want to create.

This function returns a Writableworkbook.

It gets created, i am able to create new sheets in this workbook and check the number of sheets using system.out.print.

But, i am not able to see the file physically. It is not created anywhere.
My requirement is that the newly created file must open up.

Please help me.
Thanks,
Kalai
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So: you read the file into memory. That's step 1. Then you made some changes to it in memory. That's step 2. But you're missing step 3, which is to write the workbook out to a file. Looking at the API documentation I can see a method that does that.
 
Kalai Selvi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean the following method :

writableWorkbook.setOutputFile(new File("fileformat.xls"));

where fileformat.xls is the name of the workbook i am creating.

I tried this earlier itself. It gives me the

Warning: Rewriting a workbook with non-empty data

Am i missing out anything else?
 
Paul Clapham
Sheriff
Pie
Posts: 20966
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know nothing about jExcel. But I tracked its API documentation down on the internet. I see the class you're asking about has a write() method. Is that not what you want?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic