![]() |
String Grid nach Excel kopieren
Hallo,
ich möchte die Daten eines String Grid nach Excel kopieren. Am liebsten wäre es mir wenn es mit STRG C im String Grid und STRG V in Excel gehen würde. Leider geht das nicht. Kann mir hier jemand helfen ? Tanja :angel: |
Re: String Grid nach Excel kopieren
Hallo,
du kannst mal das probieren:
Delphi-Quellcode:
- func_explode: such mal hier im Forum nach
procedure Proc_Stringgrid_GridInhaltInZwischenablageKopieren(Grid:TStringgrid);
var arow,acol:integer; sl:Tstrings; s:string; begin sl:=TStringList.Create; try with Grid do begin for arow:=0 to RowCount-1 do begin s:=''; for acol:=0 to ColCount-1 do begin if acol=ColCount-1 then s:=s+cells[acol,arow] else s:=s+cells[acol,arow]+chr(vk_tab) end; sl.Add(s); end; end; Clipboard.SetTextBuf(pchar(sl.Text+#0)); finally sl.Free; end; end; procedure Proc_Stringgrid_GridInhaltAusZwischenablageEinfuegen(Grid:TStringgrid); var arow,acol,i:integer; sl:Tstrings; s:string; arr:TSTringdynarray; begin sl:=TStringList.Create; try sl.text:=Clipboard.AsText; with Grid do begin rowcount:=sl.count+fixedrows; arow:=FixedRows; for i:=0 to sl.Count - 1 do begin rows[arow].clear; arr:=Func_Explode(chr(vk_tab),sl[i]); for acol:=0 to high(arr) do begin if acol<=colcount-1 then cells[acol,arow]:=arr[acol]; end; inc(arow); end; end; finally sl.Free; end; end; ![]() - aus der Zwischenablage: Colcount wird nicht gesetzt, das benötige ich nicht. - Export ist alles mit fixedrows, import nur die "Daten". Gruß Frank |
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:51 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