Autor Beitrag
Borstel75
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Mo 27.02.06 16:12 
Hallo,

ich möchte gern den Inhalt und Eigenschaften, wie Zellfarbe und Liniendicke,
aus einer StringGrid in eine Exceldatei exportieren. Kann mir jemand ein Beispiel
geben, wie ich Farbe und ähnliches für einzelne Zellen übergeben kann. Die Eigenschaften für die StringGrid stehen in einem zweidimensionalen Array
(z.B. Eigenschaft[x,y].Farbe).

wichtig: Die Eigenschaften muss ich einer Zelle direkt zuweisen können.

Danke im Vorraus.
digi_c
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1905

W98, XP
D7 PE, Lazarus, WinAVR
BeitragVerfasst: Mo 27.02.06 21:00 
Also ich poste es einfach mal Suche bei Delphi-Treff STRINGGRID-INHALT NACH EXCEL EXPORTIEREN
Borstel75 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Di 28.02.06 09:38 
Nun müsste ich noch wissen, wie ich Eigenschaften übergeben kann. Wie kann ich eine
Farbe einer Excel-Zelle zuweisen. In dem Beispiel werden nur die Zellwerte exportiert.
Peter Wolf
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37

WinXP Pro
Delphi7 Ent.
BeitragVerfasst: Di 28.02.06 10:56 
Einmal gegoogelt und schon gefunden ...

www.dsdt.info/tipps/?id=605
Borstel75 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 27



BeitragVerfasst: Di 28.02.06 11:14 
Bedanke mich. Es ist genau das, was gesucht habe.
Bronstein
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 578
Erhaltene Danke: 1

WIN XP
Delphi 6 / Delphi 2006 / Delphi XE
BeitragVerfasst: So 13.07.08 13:28 
Hallo,
ich möchte auch ein Stringgrid nach excel exportieren.

Habe mir das auch mal im Delphi-Treff angeschaut, hier werden leider nicht die Farben mitübernommen. Wie kann ich also die Farbe einer Zelle ermitteln. Hier mal der Code von mir, der ist wesentlich kürzer und liefert dasselbe Ergebnis.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
  Excel := CreateOleObject('Excel.Application');
  Excel.Workbooks.Add;
  Excel.Visible:= true;

  for i:=0 to StringGrid1.RowCount-1 do
  begin
    for z:=0 to StringGrid1.ColCount-1 do
    begin
      Excel.Cells[i+1, z+1].Value := Stringgrid1.Cells[z, i];
     { if i > 0 then
      begin
        if (z = 2) or (z = 3) or (z = 4) then
        begin
          if Stringgrid1.Cells[z, i] <> '' then
          begin
            Excel.Range[IndexToName(z) + IntToStr(i+1)].Select;
            Excel.ActiveCell.Interior.Color := clYellow;
            if StrToFloat(Stringgrid1.Cells[z, i]) > 95 then
              Excel.ActiveCell.Interior.Color := clLime;
            if StrToFloat(Stringgrid1.Cells[z, i]) < 90 then
              Excel.ActiveCell.Interior.Color := clRed;
          end;
        end;
      end; }

    end;
  end;


Wie bekomme ich es also hin, dass die Farben auch übernommen werden

_________________
Es gibt keine dummen Fragen nur dumme Antworten!!!
Bronstein
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 578
Erhaltene Danke: 1

WIN XP
Delphi 6 / Delphi 2006 / Delphi XE
BeitragVerfasst: Mo 21.07.08 10:02 
Hat denn niemand eine Idee, wie ich die farben mit exportieren kann!

_________________
Es gibt keine dummen Fragen nur dumme Antworten!!!
ZeitGeist87
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1593
Erhaltene Danke: 20

Win95-Win10
Delphi 10 Seattle, Rad Studio 2007, Delphi 7 Prof., C++, WSH, Turbo Pascal, PHP, Delphi X2
BeitragVerfasst: Mo 21.07.08 10:11 
Die Farben musst du manuell setzen.

Geht eben über das Automatisierungsobject ;-)

_________________
Wer Provokationen, Ironie, Sarkasmus oder Zynismus herauslesen kann soll sie ignorieren um den Inhalt meiner Beiträge ungetrübt erfassen zu können.