![]() |
Exel datei in stringrid
Hallo erstmal!!!
Ich weiß dass es dieses Thema hier schon tausendmal gab :roll: ich frag aber trozdem, weil ich nicht das gefunden hab was ich wollte: Wie kann ich eine exel Datei in ein(e) Stringrid laden ? Möglicht ohne dass exel auf dem rechner installiert ist Danke im voraus. |
Re: Exel datei in stringrid
Ohne Excel? Da fällt mir als einzige Lösung nur
![]() |
Re: Exel datei in stringrid
Hab die kompo:
Wie kann ich sie installieren? Da kommt diese fehlermeldung:[Fatal Error] FlexCel50.dpk(113): Unit UFlxMessages was compiled with a different version of VarUtils.VarDateFromStr Wie kann ich das beheben? |
Re: Exel datei in stringrid
Du brauchst wohl das Packet passen zu deiner Delphi Version. Der dateiname FlexCel50.dpk läßt darauf schließen, dass es sich um ein Packet für Delphi 5 handelt. Laut deinen Angaben hast du aber Delphi 6 (Enterprise).
|
Re: Exel datei in stringrid
Ja das ist mir klar denn bei der kompo ist auch FlexCel60.dpk dabei (Die fehlermeldung hab ich kopiert als ich es mal mit diesen Packet ausprobiert hab)
Dund das ding auch nicht! |
Re: Exel datei in stringrid
Und wie könnte ich das machen wenn excel auf dem rechner installiert ist?
|
Re: Exel datei in stringrid
Also ich habe jetzt folgende function bei
![]()
Delphi-Quellcode:
leider weiss ich nicht was die variable "Variant" (Excel : Variant;) ist und ich hab keinen Plan was ich für sie einsetzen sol.
Function ExcelCopyToStringGrid(
Excel : Variant; ExcelFirstRow : Integer; ExcelFirstCol : Integer; ExcelLastRow : Integer; ExcelLastCol : Integer; StringGrid : TStringGrid; StringGridFirstRow : Integer; StringGridFirstCol : Integer; SizeStringGridToFit : Boolean; {Make the StringGrid the same size as the input range} ClearStringGridFirst : Boolean {cells outside input range in StringGrid are cleared} ): Boolean; Var C,R : Integer; Begin Result := False; If ExcelLastCol < ExcelFirstCol Then Exit; If ExcelLastRow < ExcelFirstRow Then Exit; If (ExcelFirstRow < 1) Or (ExcelFirstRow > 255) Then Exit; If (ExcelFirstCol < 1) Or (ExcelFirstCol > 30000) Then Exit; If (ExcelLastRow < 1) Or (ExcelLastRow > 255) Then Exit; If (ExcelLastCol < 1) Or (ExcelLastCol > 30000) Then Exit; If StringGrid = nil Then Exit; If SizeStringGridToFit Then Begin StringGrid.ColCount := ExcelLastCol - ExcelFirstCol + StringGridFirstCol + 1; StringGrid.RowCount := ExcelLastRow - ExcelFirstRow + StringGridFirstRow + 1; End; If ClearStringGridFirst Then Begin C := StringGrid.ColCount; R := StringGrid.RowCount; StringGrid.ColCount := 1; StringGrid.RowCount := 1; StringGrid.Cells[0,0] := ''; StringGrid.ColCount := C; StringGrid.RowCount := R; End; Result := True; For R := ExcelFirstRow To ExcelLastRow Do Begin For C := ExcelFirstCol To ExcelLastCol Do Begin Try StringGrid.Cells[ C - ExcelFirstCol + StringGridFirstCol, R - ExcelFirstRow + StringGridFirstRow] := Excel.Cells[R, C]; Except Result := False; End; End; End; End; Bei "uses" dieser unit war auch noch eine datei deklaiert die ich nicht habe die aber widerum ur von einer function gebeaucht wird. weiß da irgend jemand hilfe? |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:08 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz