Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Probleme mit Excel-Import in StringGrid (https://www.delphipraxis.net/179947-probleme-mit-excel-import-stringgrid.html)

Rued 12. Apr 2014 17:52

Probleme mit Excel-Import in StringGrid
 
Aktualisierung: Thema/Problem hat sich erledigt! Ich habe mich in der zu ladenden Excel-Tabelle getäuscht - ein absolut idiotischer Fehler!

Hallo!

Die bekannte Import-Routine von swissdelphicenter liefert mir sowohl mit

x := XLApp.ActiveCell.Row;

als auch mit

x := Sheet.UsedRange.Rows.Count;

falsche Werte für den Fall, dass in einer Zeile eine unterschiedliche Anzahl an Zellen belegt sind.

In der Konsequenz werden zuwenig Zeilen eingelesen.

Gibt es Abhilfe?

Gruß

Rued

p80286 12. Apr 2014 18:46

AW: Probleme mit Excel-Import in StringGrid
 
Versuch es doch mal hier mit:
Delphi-Quellcode:
  excel.workbooks.Open(Filename:=dateiname);
  excel.activeworkbook.sheets[blattnr].activate;
    {-- Excel zählt von 1..x !}
  maxZeil:=excel.activesheet.usedrange.rows.count;
  maxSpal:=excel.activesheet.usedrange.columns.count;
Gruß
K-H

Rued 13. Apr 2014 10:31

AW: Probleme mit Excel-Import in StringGrid
 
Zitat:

Zitat von p80286 (Beitrag 1255459)
Versuch es doch mal hier mit:
Delphi-Quellcode:
  excel.workbooks.Open(Filename:=dateiname);
  excel.activeworkbook.sheets[blattnr].activate;
    {-- Excel zählt von 1..x !}
  maxZeil:=excel.activesheet.usedrange.rows.count;
  maxSpal:=excel.activesheet.usedrange.columns.count;
Gruß
K-H

Hatte doch schon geschrieben, dass es mit "x := Sheet.UsedRange.Rows.Count;" nicht klappt.

Gruß

Rued


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:18 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz