apache-poi

Apache POI. How do I set the page layout / paper size for a Word document?

I am trying to create a Word document from scratch using the Apache POI package. Outputting simply-formatted text has not proved to be a problem but I would like to change the page size. How do I set the page layout / paper size for a Word document? Can anyone point me to useful examples for using POI to create Word documents? ...

Problem Using POI To Set CellStyleProperty With HSSFCellUtil

I have a Java class which uses Apache POI to generate reports in Excel. When I run the Java class from my IDE or command prompt, I only see warning messages from LOG4J as below: log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter). log4j:WARN Please initialize the log4j system pro...

Unable to use XSSF with Excel 2007

Hello All, I am having tough time getting to read data from excel 2007. I am using XSSF to read data from a specific cell of excel but keep getting error - Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlbeans.XmlOptions.setSaveAggressiveNamespaces()Lorg/apache/xmlbeans/XmlOptions; at org.apache.poi.POIXMLDo...

generate excel in java

I want to generate excel with enabling auto-filter option.For that I have create one template excel file by enabling auto-filter option but when I write something into that template excel file auto-filter option disabled again. Is there any solution to create excel file by enabling auto-filter option. ...

Referencing sheets in Apache POI Formulas

Hello, I am using apache POI 3.6 to generate excel (2003) sheets. I want to insert a formula to a cell which calculates a sum of a certain cells on several sheets. I have sheets named a, b and c and want to calculate the sum the cells A1 I tried: cell.setCellFormula("a!A1+b!A1+c!A1"); POI does not produce any errors, but when ...

POI Auto Filter

How do I use Apache POI to pre-define an auto-filter region in an Excel 2007 document? A small code example or link would be nice. ...

append data into xlsx file through java

Hello I am using apache poi for writing into .xlsx file.I can write into .xlsx file but I am unable to append new content.How can I append new content in the .xlsx file Thanks in advance My Code is public static void write(){ try { Workbook[] wbs = new Workbook[]{new XSSFWorkbook()}; Workbook workbook=...

JAVA - Apache POI OutOfMemoryError while writing Excel File

I am writing an Excel File using Apache POI. I want to write in it all the data of myResultSet which has the fieldnames(columns) stored in the String[] fieldnames. I have 70000 rows and 27 columns My Code: String xlsFilename = "myXLSX.xlsx"; org.apache.poi.ss.usermodel.Workbook myWorkbook = new XSSFWorkbook(); org.apache.poi.ss.user...

What causes 'NullPointerException' in this piece of code, reading Excel cells?

Hi Intellects, I'm using Apache POI for reading Excel. I've been asked to store the cells into MySQL 5.1. While I'm reading Excel cells, I've been thrown NullPointerException. This is my code snippet : int rows = sheet.getPhysicalNumberOfRows(); for(int r = 1; r<rows; r++) { HSSFRow row = sheet.getRow(r); ...

Title in POI created PowerPoint slide not preserving formatting when copying

Hello, I'm creating a PowerPoint slide using POI and I need to be able to copy and paste it to another presentation. I'm running into a problem where the title of the generated slide adopts a bulleted list style when copying it. Any ideas on how can I fix this? I tried both the production version (3.6-20091214) and the beta version (...

How to groupColumn in .xlsx files using POI 3.6 ?

Hello, I recently switched from POI 3.1 (HSSF) to POI 3.6 (XSSF) and encountered a problem. The problem is that the groupColumn no longer works as expected! Does anyone know why the column grouping works properly only BEFORE writing in the cells from the worksheet and does not work well AFTER the worksheet is written? Is there a way...

How do I create a connector in Powerpoint with Apache POI?

I am using Apache POI to create simple org charts in Powerpoint. I want to create connectors between the elements (rectangles) of the chart. I can create an AutoShape that is of type ShapeTypes.BentConnector3, which is what I want to use to connect them, but I can find no way to attach this connector to my rectangle AutoShapes. Can any...

how to export/generate two files at once?

I have an requirement of generating two excel files at once. We are using Apache POI for generating excel files and struts framework. Within the action class, the steps are like, OutputStream outputStream = response.getOutputStream(); and then populate data from db and created one file using POI and called, response.setContentType("...

how to copy one workbook sheet to another workbook sheet using apache POI and java

I have one excel file with single sheet(abstract model).now i want to copy the sheet to another existing workbook. How to do? Please anybody have a solution kindly share with me.... I am very much expecting your valuable reply... Thanks, Yours P.Saravanan. mailId:[email protected] ...

Text replacement in WinWord doc using Apache POI

I need to replace certain text in a WinWord document. The problem is, any text replacement I do on a Range with the replaceText function creates a broken WinWord file unless the replacement and replaced strings are both the exact same length. We will be dealing with dynamic content, so this will not do. Range object specs: http://poi.ap...

Display Excel sheet in the Browser?

Hi, I need to display the newly generated excel (from tables using Apache POI) in a web browser (whatever it is, Firefox, Opera or IE). I've created the JSP file with contentType="application/vnd.ms-excel" But I'm not getting it. Here's my code snippet : <%@page session="true" contentType="application/vnd.ms-excel" pageEncodin...

please help to solve my problem in apache poi and excel

Hi, i am using apache poi and java for excel manipulation.i have modified some of the cell in excel file by programatically using java. After that, when i opening that excel file manually for seeing that update.after seeing, when i try to close the excel file it again ask me like "do you want to save the changes you made to test.xls fil...

Find Excel Cell by Text in Apache POI

Hi all I'd like to find a cell in an Excel sheet by its text. The text is something like %t: sheet.findCell("%t"); // pseudo-code, not working My goal is to enable the user to provide kind of template, in which data is written. Colours and fonts, as well as data's position can be configured by the user in an Excel file. This %t cell ...

How should i replace the string in word document with another string using poi?

Hi all, i new to poi.i have a requirement to develop and edit the word document using poi.please send any sample examples for above question. [Edit: Email deleted, come back here if you want answers] regards: venkatesh ...

How do I embed a file in an Excel spreadsheet using POI?

More specifically I would like to embed an XML document. The idea is either to display the XML in a text pane of some sort or have an icon which would open the XML document with the default system editor (Notepad, IE, XML Spy or whatnot). What I am looking for is what you get when you in Excel choose Insert -> Object... and then choose ...