RE: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread Anthony Andrews
Hello Mark, Can we have a look at some code please? We need to know how you are getting the cell styles from the template in the firast place, how you are storing them, what you are doing when you create a cell, etc. In your case, I would create a pool of cell styles - use one of the collection

Write a (very) huge Excel file.

2009-01-09 Thread Winarto
Hi all, I'm currently converting an XMLSS based file into a real Excel file. The XMLSS based file is about 100-200MB (yes it's one hundred to two hundred megabytes) containing about 30k records. I have been able to parse the XML file within 10-20seconds, but the problem comes when creating the

RE: Write a (very) huge Excel file.

2009-01-09 Thread kk
Hi Winarto, >It is always throwing java.lang.OutOfMemoryError: >Java heap space error in around 15-16k records. Is there any tips or >advise that I can use to avoid that error? had the same problem, just give the Java virtual machine more heap. %jre_path%java -Xms128m -Xmx512m -classpath ... Th

HSSF: Write Excel-spreadsheets

2009-01-09 Thread kk
Hello togeher, I've written an application using POI for creating and writing Excel spreadsheets. Works fine so far but I've got following problem: I've got an existing Excel spreadsheet which I'd like to customize, e.g. first A 1 0 2 0 3 0 (content of cell:=sum(A1..A2)) then after Java-proce

Re: HSSF: Write Excel-spreadsheets

2009-01-09 Thread Pierre Lavignotte
Hi Karsten, Just call HSSFFormulaEvaluator.evaluateAllFormulaCells(workbook) to refresh the whole workbook formula results. For you getRow() issue, I think this has been changed since POI 3.2. In this version the method signature is : HSSFRow org.apache.poi.hssf.usermodel.HSSFSheet.getRow(int row

RE: Write a (very) huge Excel file.

2009-01-09 Thread kk
Hi Winarto, sorry for not seeing that you configured your JVM. I had ASCII-files with about 170.000 lines, which I transferd in an Excel spreadsheet (the *.xls was about 50MB). This worked fine with POI 3.1. Ok your files are about 4 times bigger, but it should work out too. Best regards...

Re: Write a (very) huge Excel file.

2009-01-09 Thread Anthony Andrews
I cannot recall the details - and it may not therefore be exactly applicable here - but I think that Yegor proposed a solution for creating very large files a few months ago. It involved creating template files and then populating them and I am not at all clear on the details. If you can visit t

Re: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread Anthony Andrews
OK Mark, here is one very simple example - well in the attached files there is. If you look first at the Excel temple file, you will see that it contains five columns each with a title in the topmost cell. The cell in row two of each column has been formatted - a date, an integer, a floating poi

RE: Write a (very) huge Excel file.

2009-01-09 Thread Winarto
Hi Karsten, I've managed to reduce the number of objects that I'm creating (i.e. reuse the existing object instead of using 'new' keyword), and it has help to parse more records than before. However outofmemoryerror is now always pointing to the creation of POI object, which I don't have much co

RE: Write a (very) huge Excel file.

2009-01-09 Thread Anthony Andrews
Just had a quick search myself and found the response from Yegor that I was looking for. It will not work for you however as I think he is talking about creating large xml files. Have pasted his reply below; Unfortunately poi-ooxml has quite a good appetite for memory, under same conditions you

RE: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread Mark Hansen
Anthony Andrews wrote: > > > Hello Mark, > > Can we have a look at some code please? We need to know how you are > getting the cell styles from the template in the firast place, how you are > storing them, what you are doing when you create a cell, etc. > > I will work on creating an exampl

RE: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread Anthony Andrews
Must admit Mark that I have seen some problems with regard to Date/Time cells that is very similar to your 'setting type before value' problem. Also, there was a cloneStyleFrom() method added to the HSSFCellStyle class some time ago and it seemed to disappear again. If it is still there, then it

RE: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread Mark Hansen
Anthony Andrews wrote: > > Must admit Mark that I have seen some problems with regard to Date/Time > cells that is very similar to your 'setting type before value' problem. > Also, there was a cloneStyleFrom() method added to the HSSFCellStyle class > some time ago and it seemed to disappear ag

Re: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread David Fisher
You can clone using something like: public static HSSFCellStyle cloneStyle(HSSFWorkbook wb, HSSFCellStyle src){ HSSFCellStyle style = wb.createCellStyle(); style.setFont(wb.getFontAt(src.getFontIndex())); style.setAlignment(src.getAlignment()); style.setBord

Re: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread Mark Hansen
Thank you for your help, David. Are you saying that I should not close the style using the cloneStyleFrom() method on the HSSFCellStyle object? This method is in the 3.2-FINAL release I'm using and seems to be working. Is it going to be removed in a later release? Thanks, David Fisher wrote: >

Re: Applying a data format to a style for one cell affects other cells?

2009-01-09 Thread David Fisher
If it is working go ahead. The code I quoted from is from a special class of ours that we use to manage Styles in our XLS creation process. It helps to remind everyone that styles are stored in the workbook and then later associated with a cell. It really helps to manage your styles as quic