Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Open Source Projects
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Other Open Source Projects
How tochange the values in an existing Excel file by using POI?
reubin haz
Ranch Hand
Posts: 287
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I'm pretty new to use POI. I can read values from Excel file by reading it. But during the read, it seems I cannot change Excel cell values.
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheet("sheet1"); ................. cell.setCellValue("TEST");
The above code won't really change the value to "TEST" for that cell after the program is finished.
If using FileOutStream with an output file name, I think it's just gonna overwrite the existing file, or create a new file.
How can I change the values in an existing file? Thanks.
SCJA, SCJP5.0, SCBCD, SCWCD
Ulf Dittmer
Rancher
Posts: 43081
77
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How are you saving the file after changing the value?
reubin haz
Ranch Hand
Posts: 287
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How to save it?
Thanks.
SCJA, SCJP5.0, SCBCD, SCWCD
Ulf Dittmer
Rancher
Posts: 43081
77
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
How to save it?
Does that mean you don't have any code to save the file? If so, that's what the HSSFWorkbook.write(OutputStream) method does.
reubin haz
Ranch Hand
Posts: 287
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I worked it out. I thought HSSFWorkbook.write(fileOut); where there is nothing involved with fileOut would produce an empty Excel file. But it's not.
Thanks.
SCJA, SCJP5.0, SCBCD, SCWCD
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
use Apache POI to read Excel file problem
POI excel rewrite file
Uploading Excel spreadsheet into JSP
Help needed with POI
Read a .xls,.xlsx file format using XSSF
More...