You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by vijay <vi...@fpl.com> on 2013/05/31 20:32:32 UTC

Reading macro using apache poi is taking too long

I'm big big fan of apache Poi, I used it for reading/writing excel before.
Now I want to use apache poi for reading a macro for my project.
Agreed my macro has 10 sheets but creating workbook oibject is taking too
long.


FileInputStream file = new FileInputStream(new File("C:\\test.xlsm"));

XSSFWorkbook wb = new XSSFWorkbook(file);


The step of creating workbook object is taking atleast 2 mins. Can anyone
please explain why and what can be done to improve.



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Reading-macro-using-apache-poi-is-taking-too-long-tp5712869.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Reading macro using apache poi is taking too long

Posted by Dominik Stadler <do...@gmx.at>.
Hi,

It is impossible to state anything without a look at how you create the
file or how the file looks like. Can you provide a sample file which allows
others to reproduce the behaviour?

Thanks... Dominik.


On Fri, May 31, 2013 at 8:32 PM, vijay <vi...@fpl.com> wrote:

> I'm big big fan of apache Poi, I used it for reading/writing excel before.
> Now I want to use apache poi for reading a macro for my project.
> Agreed my macro has 10 sheets but creating workbook oibject is taking too
> long.
>
>
> FileInputStream file = new FileInputStream(new File("C:\\test.xlsm"));
>
> XSSFWorkbook wb = new XSSFWorkbook(file);
>
>
> The step of creating workbook object is taking atleast 2 mins. Can anyone
> please explain why and what can be done to improve.
>
>
>
> --
> View this message in context:
> http://apache-poi.1045710.n5.nabble.com/Reading-macro-using-apache-poi-is-taking-too-long-tp5712869.html
> Sent from the POI - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
>

Re: Reading macro using apache poi is taking too long

Posted by Nick Burch <ap...@gagravarr.org>.
On Fri, 31 May 2013, vijay wrote:
> I'm big big fan of apache Poi, I used it for reading/writing excel 
> before. Now I want to use apache poi for reading a macro for my project. 
> Agreed my macro has 10 sheets but creating workbook oibject is taking 
> too long.
>
> FileInputStream file = new FileInputStream(new File("C:\\test.xlsm"));
> XSSFWorkbook wb = new XSSFWorkbook(file);

If you have a file, don't go via an inputstream! It increases the amount 
of memory needed, and slows things down. See
http://poi.apache.org/spreadsheet/quick-guide.html#FileInputStream

Other than that, when you're using a file, if it's still slow you'll need 
to use a profiler to check what code is the problem.

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org