apache-poi

Apache POI HWPF, replacing text in .doc documents fails

I try to write down the result of the POI unit test at: code here, by adding the line daDoc.write(new FileOutputStream("C:\\wordtest.doc")); to the end of the method testRangeReplacementAll. The new document is corrupt when I try to open it with word 2003. Any suggestions to fix this? ...

Choosing an excel java api.

All I need to do is open an MS excel sheet - not sure which kind yet (2003, 2007, etc.) - and parse the information in each row into an object. I'm performing only readonly operations. out of Apache POI, JExcelAPI, or OpenXLS which is best for this task? I'd rather not find out about anymore api's but if you're certain that none of the...

API to write huge excel files using java

I am looking to write to an excel (.xls MS Excel 2003 format) file programatically using Java. The excel output files may contain ~200,000 rows which I plan to split over number of sheets (64k rows per sheet, due to the excel limit). I have tried using the apache POI APIs but it seems to be a memory hog due to the API object model. I ...

How to extract plain text from a DOCX file using the new OOXML support in Apache POI 3.5?

On September 28, 2009 the Apache POI project released version 3.5 which officially supports the OOXML formats introduced in Office 2007, like DOCX and XLSX. Please provide a code sample for extracting a DOCX file's content in plain text, ignoring any styles or formatting. I am asking this because I have been unable to find any Apache P...

convert excel cell text into number poi

HAI i want ot convert a cell text value into a number in Excel using POI API. cell text value like '2,345' to conver as a number. How can i do that. if any has face this problem,please let me know... ...

Display prcentage values in Excel using POI API.

i need to show a value in excel cell like in 12.3% in the cell.but it should be able convert into a number.by default it is considering as a text.But i want it as a number. if any body overcome this problem.please let me know. ...

Hyperlinks in Excel generated in java

I've to create hyperlinks in Excel as above. On click of the hyperlink, the data should be populated somewhere down the excel. Am using Apache POI to generate the excel. is it possible with POI or other tools to generate such hyperlinks. ...

Will apache poi work with J2Me?

I wish to use apache poi libraries for accessing powerpoint files in a blackberry application I am developing. Adding the jar's as external libraries causes preverification errors. (compiles successfully). My question - Can I use apche poi libraries in a J2ME application? If not is there a version of apche poi available for use with J2M...

HSSFCell - determining what type of numeric

Using Apache POI, I am trying to process a large amount of numeric data. I am checking for the cell type, for instance case HSSFCell.CELL_TYPE_NUMERIC: value = String.valueOf(cell.getNumericCellValue()); break; Is there a way I can determine what type of numeric value the cell holds? For instance,...

Apache POI path settings doubt

How to integrate Apache POI, Apache Forrest and Ant to work with Microsoft Excel sheets (.xls) using Java? Any IDE or is the command line enough? I have downloaded Apache POI, poi-bin-3.5-FINAL-20090928.zip. There is no bin folder after unzipping it. ...

Which is better open source for Excel file parsing in Java?

Which is better API for excel parsing in Java Apache POI or JExcel API? In terms of speed, memory utilization and code stability. ...

syntax error on createCell

i'm getting a syntax error on row.createCell line Multiple markers at this line - Syntax error on token "createCell", = expected after this token - Syntax error on token(s), misplaced construct(s) this is the code HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("new sheet"); HSSFRow row = sheet.cr...

excel file not generating after UTF-8 encoding chosen

This part of my code was creating xls file successfuly FileOutputStream fileOut = new FileOutputStream("c:\\Decrypted.xls"); wb.write(fileOut); fileOut.close(); when other part of the code had this statement ( which was before the above code ) in = new ByteArrayInputStream(theCell_00.getBytes("")); But when I changed it to in ...

How do I determine that an instance of org.apache.poi.hwpf.model.ListData belongs to a numbered list or bulleted list?

Is there a way to determine if an instance of a org.apache.poi.hwpf.model.ListData belongs to a numbered list or bulleted list? I am using Apache Poi's org.apache.poi.hwpf.HWPFDocument class to read the contents of a word document in order to generate HTML. I can identify the list items in the document by checking to see that the paragr...

Apache POI HSSF/XSSF - Evaluating Formulas That Don't Live In Cells

With a known formula extracted from a spreadsheet, is it possible to apply/evaluate the formula without having it reside in an actual cell? I suppose one can create / locate a blank cell on the sheet (anyone have any ideas how this might be done efficiently?) and evaluate the formula this way, but is there a better way? ...

Word document creation API in Java

I would like to create a word document using a template, replace some variables (fields) and save it as a new word document. I was thinking using Apache POI, http://poi.apache.org/ is it the best for this purpose? can you share your impression from it? ...

Issues and gotchas with new POI 3.6 API (XSSF) working with Excel 2007 workbooks

I just started using the new POI 3.6 http://poi.apache.org XSSF which was released in December 2009. The updated API provides support for reading and writing in the OOXML spreadsheet format (.xslx) with Java. So far I've been pretty impressed with the API and haven't really encountered any issues with it. What issues or gotchas have you...

NoClassDefFoundError while using api XSSF

I want to read an xlsx file using api XSSF. For that I downloaded poi-3.6 api and then did set the correct classpath but then too when I run my program I get an Exception as in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/xssf/usermodel/XSSFWorkbook But I can read xls file using HSSF api without any exception. ...

how to change the tab color of a worksheet with Apache Poi

I am trying to set the background color of a worksheet tab using Apache POI. I can't seem to figure out how to set the style on the tabs themselves though. Thanks for the help! ...

Java Apache POI Excel reading exception

I'm trying to use POI to read an Excel file. It will be a large file ( > 50k rows) so I'm using the eventusermodel rather than the simpler usermodel which reads the entire file into memory. My code looks like: File file = new File("C:\\bigfile.xls"); InputStream input = new FileInputStream(file); EventRecordFactory factory =...