AdvStringGrid Xlsx import and export.


I would like to have my data in AdvStringGrid interacting with excel xlsx file. I do have FlexCelVCLNT and TMS FMX UI Pack.
There are four options to do that:

  1. AdvStringGrid->import from or export to xlsx file with OLE automation. It works fine. But it is not my preferred method because it involves OLE;
  2. Use AdvGridExcelIO to import and export. It worked before, but It doesn't any more.
  3. Use AdvGridExcelImport and AdvGridExcelExport.. I have trouble to use this method. I made a simple project and it works fine, when I use exactly the same codes in my big project, I got access violation after I saw the excel data imported showing on the advGrid. then it threw exception. My question here is what should I check to further identify the problem in my big project?
  4. As I already have FlexCel, I can re-pupolate advgrid data to a flexCel excel file and save that. But that defeats the purpose of having all advstringgrid advanced features.

I am wondering for those 4 options, if some one can make comments on those methods and give me a recommendation what method is the best in terms of the simplicity and efficiency.

Any comments and recommendations are much appreciated!


TAdvGridExcelIO supports XLS files only
LoadFromXLS() supports XLS and XLSX but it requires Excel to be installed

For XLSX support without needing Excel, TMS Flexcel Grid Bridge TMS VCL Grid Excel Bridge | TMS Software | VCL, FMX, .NET controls & components for Delphi, C++Builder & Visual Studio | is the recommended solution.
This should offer the fastest path to loading Excel files in TAdvStringGrid.
We are not aware of issues with this, so if you experience a problem, we'll need to know more details how to reproduce this to be able to investigate.

Dear all

I plan to import an XLSX file in a TAdvStringGrid, but unfortunately can' t manage it.
There are valid licences for FlexCel and VCLAdvUIPack. Both of these plus the Grid Excel Bridge have been installed with TMS Setup.
Delphi version is Berlin.
From the 4 messages shown below: do you have any idea what I am doing wrong?

  1. AdvGridExcelImport1 dropped on the main form of an existing project
    uses ... UAdvGridExcelImport;
    [dcc64 Fataler Fehler] u_Main.pas(21): F2613 Unit 'FlexCel.XlsAdapter' nicht gefunden.
    u_Main.pas(21): Unit 'FlexCel.XlsAdapter' wird von 'UAdvGridExcelImport' verwendet

  2. C:\Users\heinz\Documents\tmssoftware\FlexCelVCLNT\Demo\Delphi}MainDemo.dpr

  3. C:\Users\heinz\Documents\tmssoftware\VCLExcelBridge\Demo\Delphi\SimpleImport\SimpleImport.dpr
    [dcc32 Fataler Fehler] USimpleImport.pas(7): F2048 Falsches Unit-Format: 'C:\Users\heinz\AppData\Local\tmssoftware\registered\TMS VCL UI Pack\Advobj.dcu' - Erwartete Version: 31.0, Windows Unicode(x86) Gefundene Version: 31.0, Windows Unicode(x64)

  4. C:\Users\heinz\Documents\Embarcadero\Studio\Projekte\Project_TestImportXLX.dpr
    New project with TAdvStringGri; Grid assigned to AdvGridExcelImport1; then Import(OpenDlg.FileName);
    [dcc32 Fataler Fehler] U_testImportXLSX.pas(8): F2051 Unit UAdvGridExcelImport wurde mit einer unterschiedlichen Version von AdvGridWorkbook.TAdvGridWorkbook compiliert

Thanks for your help in advance

It is a strange set of messages, but let's see them:

  1. This normally means that FlexCel isn't in the library path. The installer should take care of that, but maybe there was an error. The strange part is that number 2. is ok, so Delphi is finding the units. Now, looking at number 3, I wonder if there can be a problem with Win64 but not with Win32?

So the first question would be: Is your app win32 or Win64? If it is win64, can you run the demos in 2. but compiled in Win64?

Can you check your library path? If it is win64, it should have this entry: $(FLEXCELVCLNT)\Packages\dBerlin\Win64\Release

If your app is 32 bit check the same entry selecting 32 bit in the combobox I circled in red.

  1. Is it ok if you select the same bits as your app?

  2. Looks like either you are trying to link a 64bit dcu in a 32bit app, or a 32bit dcu in a 64bit app. Once again, check the correct bits of your library path, and make sure the paths are ok.

  3. This normally means that you have more than one advgridworkbook.dcu in your library path. To solve this one, you normally need to search your hard disk for advgridworkbook (.pas or .dcu) and make sure that there is only one version available. If there is a single advgridworkbook this error shouldn't happen.

Good morning Adrian

Thank you for the quick response.

I have to admit that I caused the described issues myself - now it works as expected.
I deinstalled all TMS apps first and then installed the LATEST versions if VCLUIPack, Flexcel, and the Grid Excel Bridge.
My fault obviously has been to ,uipdate the UI pack only and to let Flexcel in ist former version..

Best regards