![]() ![]() as a numerical value or as a date, then the retrieved Cell must be cast to the correct type and the appropriate methods called. However if it is required to access the cell's contents as the exact type ie. The demo programs CSV.java and XML.java use the convenience method getContents() in order to output the spreadsheet contents. The contents of these cells may be accessed as follows In the example code below, A1 is a text cell, B2 is numerical value and C2 is a date. You can retrieve the cell's contents as a string by using the convenience method getContents(). Once you have a sheet, you can then start accessing the cells. (You can also use the API to retrieve a sheet by name). These are zero indexed - the first sheet being 0, the second sheet being 1, and so on. Once you have accessed the workbook, you can use this to access the individual sheets. (NOTE: when creating a spreadsheet from a ServletInputStream you must remove the HTTP header information before creating the Workbook object.) Workbook workbook = Workbook.getWorkbook(new File("myfile.xls")) The code fragment below illustrates creating a workbook from a file on the local filesystem. ![]() The first step when reading a spreadsheet from a file or input stream is to create a Workbook. JExcelApi can read an Excel spreadsheet from a file stored on the local filesystem or from some input stream.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |