AdvGridWorkbook <-> AdvGridExcelExport <-> Flexcell

Hello

I'm trying to fill an AdvGridWorkbook with steps describe here:

My code:

 xls := TExcelFile.Create; //created once
....
  if FileOpenDialog1.Execute then
  begin
    xls.Open(CurrentExcelFilename);
    xls.ConvertFormulasToValues(false, true);
    AdvGridExcelImport1.Import(xls);
  end;

With AdvGridExcelImport, when using an AdvGridWorkbook, no data will be displayed.
If I replace my AdvGridWorkbook with an AdvGrid, grid is correctly filled

Is there any existing issue when working with AdvGridWorkbook ?

Kind regards

Hi,
We aren't aware of issues, but there of course always be one.
I made a very simple app here:

https://download.tmssoftware.com/flexcel/img/wbook_test.zip

And it seems to be working as expected. Can you find a way to modify it so it shows your problem, or maybe send me a different app with the issue to adrian@tmssoftware.com?

Hi Adrian,

I was the culprit I guess… If you look at structure pan, 2 TAdvGridWorkbooks where create as child into AdvGridWorkbook1 !!! Sorry for that.

I still have a question for you:

After loading an Excel file, ROW[0] and COL[0] stay empty. How can I mimic Excel and get both ROW[0] and COL[0] values filled numbers and letters?

Thank you

Log_835c0a15-c39a-443c-989d-cfa938b0b17c.png

Hi,
There is no direct way that I know of to do that directly, (but I am no expert in AdvStringGrid, maybe there is a property out there that I am not aware of).

But personally, I would just fill the cells directly. You could add this code to the app:

 for var i := 0 to AdvGridWorkbook1.Sheets.Count - 1 do
  begin
    AdvGridWorkbook1.ActiveSheet := i;
    for var row := 1 to AdvGridWorkbook1.Grid.RowCount - 1 do
    begin
      AdvGridWorkbook1.Grid.Cells[0, row] := IntToStr(row);
    end;
    for var col := 1 to AdvGridWorkbook1.Grid.ColCount - 1 do
    begin
      AdvGridWorkbook1.Grid.Cells[col, 0] := TCellAddress.EncodeColumn(col);
    end;

  end;

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.