excel-templates icon indicating copy to clipboard operation
excel-templates copied to clipboard

RowFlushedException on render-to-file with more than 100 rows

Open dpetranek opened this issue 8 years ago • 8 comments

When I run render-to-file on datasets longer than 100 rows, I get a RowFlushed Exception:

(render-to-file
     "templates/test.xlsx"
     "repltest.xlsx"
     {"Sheet1" {0 (mapv #(conj [] %) (range 101))}})

=> ; RowFlushedException Row 0 has been flushed, cannot evaluate all cells org.apache.poi.xssf.streaming.SXSSFFormulaEvaluator.evaluateAllFormulaCells (SXSSFFormulaEvaluator.java:117)

I'm using a blank .xlsx workbook as the template, so there shouldn't be any problem with the SXSSFFormulaEvaluator.

If I change (range 101) above to (range 100), it works as expected.

dpetranek avatar Apr 21 '16 18:04 dpetranek

Ahh, I think that this is a side-effect of the change we made in #12. I'm going to back that out and see if I can't figure out another way to solve that. In the meantime, you might try release 0.3.0 and see if that works better for you.

tomfaulhaber avatar Apr 21 '16 18:04 tomfaulhaber

Thanks for the quick reply! Unfortunately, switching back to 0.3.0 is giving me guff - I'm getting an unfamiliar stack trace every time I try to compile - https://www.refheap.com/118065

I've got this in the project.clj dependencies: [com.infolace/excel-templates "0.3.0"] And this is in the namespace declaration of the file where I use it:

(ns emv.routes.report
  (:require [excel-templates.build :as excel]))

dpetranek avatar Apr 22 '16 16:04 dpetranek

@dpetranek That looks like you've got a mixed up class path. It says that chart.clj is looking for something from Apache Commons that wasn't added until 0.3.2. I checked the git history and clojars and I think this is right.

Is there some way that you have a version of chart.clj from master or 0.3.3 on your classpath?

tomfaulhaber avatar Apr 22 '16 20:04 tomfaulhaber

Thanks Tom. I finally got round to picking this back up, and deleting my target/classes folder cleared it up the ExceptionInInitializerError that was being thrown before. However now when I try to render-to-file, it doesn't write to disk or throw an error:

(excel-writer/render-to-file
                    "resources/test.xlsx"
                    "repltest.xlsx"
                    {"Sheet1" {0 (mapv #(conj [] %) (range 101))}})

=> nil

It returns nil but doesn't actually create repltest.xlsx. The only change I made was to change my dependency to [com.infolace/excel-templates "0.3.0"].

dpetranek avatar May 11 '16 20:05 dpetranek

Does it work if you create a single cell A1 on the template with a 0 in it?

tomfaulhaber avatar May 11 '16 23:05 tomfaulhaber

I'm afraid not.

dpetranek avatar May 12 '16 14:05 dpetranek

tested with data 46(cols) * 10000 (rows), it will take about 20 minutes to finish rendering, can you take a look and see if this can be make faster? as it only take me about 2 minutes to operate the copy & paste for those data in my excel template.

gwzbenjamin avatar Jun 20 '16 09:06 gwzbenjamin

(excel/render-to-file "resources/template.xlsx" "e:/tmp/71_test.xlsx" {"new" {1 (take 10000 rows1)} } ) OutOfMemoryError Java heap space [trace missing]

gwzbenjamin avatar Jun 21 '16 01:06 gwzbenjamin