I want to read csv files and xls and xlsx files. When I add VCL.FlexCel.Core, FlexCel.XlsAdapter to my uses clause and write
Hi,
Thanks Adrian.
Hi,
I realize this is 12 years later but I'm new to FlexCel and my application exe grew 7.3MB when I added FlexCel. All I do is read and write simple Excel files. Isn't there anything that can be done? I have many users running over a VPN and the larger application takes a noticable longer time to load.
Sadly the answer is still the same. You might be reading simple files, but FlexCel can't know that when it is opening the file. That file could include conditional formatting, charts, and a lot of other stuff that we need to understand and preserve. If you insert a row in that file, we need to modify the chart so it points to the new range after we inserted the row. etc.
Now, this being said, I just tried it here with a new file (Delphi 12, Release builds), and I get:
Empty project: 2.371mb
Project with FlexCel that opens, modifies and saves a file: 7.017
So the increase should be 4.6mb, not 7.3mb. Still big, I know, but not 7 mb
It is also more than the 3mb in the original post, but we added quite a lot of stuff in those 12 years... all that code counts. Seriously, just go to where we were 12 years ago:
and try scrolling up... I am obsessed with getting every detail right, but every thing we add, adds some lines of code, and some extra size to the exe. Still, I prefer to have it right even if big.
I can't really give you a solution (There is a saying "everyone uses a 10% of Excel, but everyone uses a different 10%"). And even if you don't realize, your simple files might not be so simple. Many times they include stuff that you aren't even aware you are using. And with people generating spreadsheets with AI, this is going to get an order of magnitude worse. But some ideas:
-
I develop FlexCel myself over a VPN (sometimes at the other side of the world, I am in south america and develop frequently from europe or australia). 7mb shouldn't affect that much (I run full RDPs over the VPNs), maybe there is something you can do to improve the VPNs. I know it might not be possible, but I mention it because 7mb in today's world shouldn't affect that much. An image in a webpage is bigger, and there is some caching that can be done so you aren't constantly downloading that file.
-
Maybe you are linking also the rendering engine? If I add "FlexCel.Render" to the mix, the size goes up to 7.892mb (an increase of 5.5 mb over an empty file). FlexCel.Render is needed to export to pdf, etc, and that adds another big layer of complexity over it (FlexCel has to now know how to convert the description of the chart into an image to put inside a pdf. And it doesn't matter that the chart is "simple", when you compile the app in your machine, FlexCel doesn't know how simple are the charts it will have to render). The main issue here is that you will need FlexCel.Render if you are autofitting rows or columns, and if that is the case, there is not much to do. But if you aren't, verify that you aren't using FlexCel.Render anywhere, as it will shrink the size (and double-verify you aren't autofitting stuff, because that will break at runtime if you remove FlexCel.Render from the app)
I was also thinking that you could use runtime packages to, even if not reduce the size, keep the packages cached in users machines, but that will probably be worse that what we are trying to solve (a single exe is a great thing).
Another thing to consider: Normally uncompressed size isn't that important, because it will travel compressed in the places that are slow (like the vpn, or when you download it from somewhere).
Comparing now the compressed empty app with the compressed "full app" (including rendering), I see a difference of 2.3 mb (931kb against 3.240mb). This is using standard zip compression, of course it would be even smaller if using better compression.