Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing a content in excel in incremental way

 
Vibhas Kumar
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends i am facing one issue while writing the content in an excel sheet incrementally.When i try to add the next content in an existing excel sheet. I loose the previous one.Can any one help me to resolve this.Here is the code for this. I have created two java classes 1.ReadXLSheet -->to read the file 2.Create--> to write the content incrementally.

Kindly look into it and resolve this issue.



*************************************************************************



Thanks in advance
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please mind your language. I've removed the offensive word from the subject.
 
Greg Charles
Sheriff
Posts: 2993
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Kumar,

You'll probably get better responses if you post less, more targeted code samples, and more information about what you're doing and what's going wrong.

In this case, I haven't worked with the jxl.Workbook class, but I see you create a new one each time you call the write() method, and pass it (I assume) the same file as a parameter. When you later call workbook.write(), I'm guessing it overwrites whatever was in the file with the new contents of the workbook. If that's not what you want to happen, you're going to have to go back to Workbook and see if it has another interface you can use.

Also, take a look at this code:


That's just confusing.
 
Lester Burnham
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The javadocs of Workbook.createWorkbook(File,WorkbookSettings) talk of "creating" a file - which doesn't sound as if it would preserve an existing one. One of the other createWorkbook methods may be more suitable.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic