to open an excel file and write
-
Looking at the documentation (this link works for me[^]) it would suggest that you need to create a
WritableWorkbook
[^] and within that create aWritableSheet
[^]. Casting aSheet
to aWritableSheet
will not change the underlying object; it is still a (read-only)Sheet
. -
thanks Richard but a
WritableWorkbook creates a new workbook and has no method which opens a workbook
Pritha
This method[^] creates one. May I suggest you go through all the documentation to check which methods are required to create the objects you are trying to work with.
-
This method[^] creates one. May I suggest you go through all the documentation to check which methods are required to create the objects you are trying to work with.
-
thanks for the article but i cant still open a writableworkbook .i can write on a new
workbook
but cant write on an existing workbook I didnt find any method doing that either in writableworkbook regards Pritha
Check this article ... may be of some help for your purpose Read and write to excel files in java
-
thanks for the article but i cant still open a writableworkbook .i can write on a new
workbook
but cant write on an existing workbook I didnt find any method doing that either in writableworkbook regards Pritha
prithaa wrote:
thanks for the article
I did not provide one, I wonder what you have been looking at.
prithaa wrote:
but i cant still open a writableworkbook
Did you follow my advice and read all the documentation in the link I gave you? It clearly shows how to create a writeable workbook from an existing file.
-
prithaa wrote:
thanks for the article
I did not provide one, I wonder what you have been looking at.
prithaa wrote:
but i cant still open a writableworkbook
Did you follow my advice and read all the documentation in the link I gave you? It clearly shows how to create a writeable workbook from an existing file.
-
yes i did read the link u sent and looked at the class writablework but there is no method which opens an existing .xls file Regards Pritha
Sorry, previous link was not correct owing to HTML frame. However, I think [this one](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))[[^](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))] is the best you will get.
-
Sorry, previous link was not correct owing to HTML frame. However, I think [this one](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))[[^](http://jexcelapi.sourceforge.net/resources/javadocs/current/docs/jxl/Workbook.html#createWorkbook\(java.io.File, jxl.Workbook, jxl.WorkbookSettings))] is the best you will get.
thanks for replying
Workbook workbook = Workbook.getWorkbook(new File("d:/Writefile.xls"));
WritableWorkbook copy = Workbook.createWorkbook(new File("d:/Writefile1.xls"), workbook);
copy.write();
WritableSheet sheet = copy.getSheet("Report2");
Number number;
number = new Number(0, 0, 453.25, times);
sheet.addCell(number);
copy.write();
copy.close();I want to open an existing file and add a cell to an existing sheet. The above code opens the file but the cell editing doesnt happen. Regards pritha
-
thanks for replying
Workbook workbook = Workbook.getWorkbook(new File("d:/Writefile.xls"));
WritableWorkbook copy = Workbook.createWorkbook(new File("d:/Writefile1.xls"), workbook);
copy.write();
WritableSheet sheet = copy.getSheet("Report2");
Number number;
number = new Number(0, 0, 453.25, times);
sheet.addCell(number);
copy.write();
copy.close();I want to open an existing file and add a cell to an existing sheet. The above code opens the file but the cell editing doesnt happen. Regards pritha
Sorry, no idea why that's happening; I think you may need to re-check the documentation and work with your debugger.
-
Sorry, no idea why that's happening; I think you may need to re-check the documentation and work with your debugger.
-
Just for the record, I have never used these packages[^]; all the information I gave you I found by using Google and reading the Javadocs.