poi

Apache POI Color cell with formula

I want create a excel with Apache POI in java and I must insert in a cell a formula: A3=B3+C3. Is possible to insert another formula in A3 that color the cell if his value is> 0? I use Apache POI 2.5.1 ...

Open Microsoft Word in Java

Hi there I'm facing a problem, anyone can help me?? The Problem is : I'm trying to open MS Word 2003 document in java, search for a specified String and replace it with a new String. I use APACHE POI for to do that. My Code is like the Following : public void searchAndReplace(String inputFilename, String outputFilename, HashMap<...

Copying Excel Worksheets in POI

Does anyone know of a means to copy a worksheet from one workbook to another using POI? The Workbook class has a cloneSheet method, but there doesn't seem to be able to insert a cloned sheet into a new workbook? If there isn't an API to do this easily, does anyone have the code to copy all of the data (styles, column widths, data, etc) ...

good way to represent a excel sheet value in Java

Consider that I've a excel sheet in below format: person age Foo 29 Bar 27 Now I want to read these values (using POI HSSF) and have to process them. What's the best way to do that? Note that I do not have a Object Person in my application, becasue the values that may come in excel sheet is arbitrary (i.e. it may not be the ...

Tool for importing Excel spreadsheets

Hi, I need to import some Excel spreadsheets into Java objects. I will use POI to do the task (an old version of it unfortunately). However I wonder if there is some high-level framework to do the same task but declaratively. I'm thinking in Castor and XML. The mapping Excel-Class will be stored in a resource (e.g. an XML file). Yes, I'...

Is there a way to display a HSSFWorkbook Object in a JSP page?

Is there a way to Display a HSSFWorkbook Object in a JSP page without having an output file in the server side. In the code below I am providing the template file and the beans required for net.sf.jxls.transformer.XLSTransformer.transformXLS(InputStream is, Map beanParams) to return me a HSSFWorkbook object. I now need a way to use this ...

How to Cache InputStream for Multiple Use

I have an InputStream of a file and i use apache poi components to read from it like this: POIFSFileSystem fileSystem = new POIFSFileSystem(inputStream); The problem is that i need to use the same stream multiple times and the POIFSFileSystem closes the stream after use. What is the best way to cache the data from the input stream an...

Negative Cell Value Styles in Apache POI

Using Apache POI to generate a document and i'm having a small problem with cell styles, currentlly i'm using: CellStyle currencyCellStyle=workbook.createCellStyle(); currencyCellStyle.setDataFormat(format.getFormat("$#,##0.00")); Which works totally fine for positive numbers, however I would like to assign a different style to negati...

Is there a way to modify a Microsoft Word footer using Apache POI?

I need to modify the content of a Word footer using a Java API. The Apache POI project does not seem to support this functionality: WARNING - you shouldn't change the headers or footers, as offsets are not yet updated! My question is twofold: Does anyone know of a way to do this using POI's API? Is there a different java API wh...

Refresh Pivot Table with Apache POI

I'm currently working on a Java application that uses a template excel file that contains a pivot table. The template file also has a data sheet that seeds the pivot table. This data sheet is dynamically loaded in the java application through the Apache POI api. When I open the excel file I must refresh the Pivot table manually to ge...

Problem with Numeric/String using Apache POI...

Hi! I have excel file with such contents: A1: SomeString A2: 2 All fields are set to String format. When I read file in java using poi it tells that B1 is numeric cell format. The problem is that the value in A1 can be 2 or 2.0 so I can't just use .toString(). Can anyone help please? ...

Java: parsing ms-word document using POI/HWPF

I have a ms-word document (MS-Office 2003; non-xml). Within this document there is a string associated with a bookmark. Furthermore, the word document contains word-macros. My goal is to read the document with java, replace the string associated with the bookmark, and save the document back to word format. My first approach was using Ap...

Apache POI xls column Remove

I dont find how to remove a column with the Apache POI API. I would appreciate a sample code or help on this point. Thank you ...

how to create .doc file using java?

Can anyone tell me how to create doc files using java? I know, there's a POI library, but it seems like it can save only simple documents. You can read anything you wish, but you can't save it all back again. Or may be i missed something? How can i save whole document with pictures, tables and styles? ...

How to insert header for every page in a document using apache poi?

I need to read a document and write its content to another file. For this i am using apache poi (getText)which prints the header once at the starting page only. i need to read all the headers at all pages and write to the corresponding file. Is there a way to get all the headers page by page? Also i need to print the page numbers dynamic...

How do I get the (Java Apache POI HSSF) Background Color for a given cell?

Hello, I have an existing excel spreadsheet, which I am accesssing and reading values from, I am using Apache POI HSSF. It is initialised like this: HSSFSheet sheet; FileInputStream fis = new FileInputStream(this.file); POIFSFileSystem fs = new POIFSFileSystem(fis); HSSFWorkbook wb = new HSSFWorkbook(fs); this.sheet = wb.getSheet(exsh...

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... ...

Java: How to paste (append) an image on clipboard to a word document.

Hi, Is there a way in Java, to copy the contents of the clipboard (an image in my case) to the end of a word document? I want to have a program that will - * Take a filename (word file) as a parameter * Whenever this program is run - it will open the word file and paste the contents of the clipboard to the end of the document. I am d...

connect Ms Access to java

I extracted data from excel using poi api. Now I want to store the data in access please clarify ...

Eclipse throwing ClassNotFoundException despite me having added the proper Apache POI .jar File ?

I'm using a servlet to upload .xls (Excel Spreadsheets) files to the server. I'm using the Apache FileUpload API for the upload portion of the business logic, to ensure weather this part is working, I have successfully attempted uploading a .txt file to the Servlet after which -- the Apache FileUpload API, from the servlet side gives me ...