Einzelnen Beitrag anzeigen

PPaB

Registriert seit: 23. Jan 2009
35 Beiträge
 
#3

Re: Excel-Sheet mit Delphi verändern

  Alt 8. Jan 2010, 21:16
habs jetzt soweit:
Delphi-Quellcode:
procedure TLieder.Excel1Click(Sender: TObject);
var Excel: Variant;
    I, J, K, L, M, N, P: integer;
    Speicherort: String;
begin
M := 13;
FindAllFiles(ExtractFilePath(Application.Exename)+'Gottesdienste/', '*.*',False);

if Excelspeichern.Execute then begin
    try
      excel := CreateOleObject('Excel.Application');
      excel.visible := False;
    except
      ShowMessage('Excel konnte nicht gestartet werden !');
    end;
    Excel.Workbooks.Add;
    for J:=0 to 11
      do begin
      Excel.Cells[1,J+1].Value :=StringGrid3.Cells[J,0];
        for I := 1 to StringGrid3.RowCount-1
        do Excel.Cells[I+2,J+1].Value :=StringGrid3.Cells[J,I];
      end;
        For N := 0 to Listbox3.Count-1 do
        begin
        Listbox2.Items.LoadFromFile(ExtractFilePath(Application.Exename)+'Gottesdienste/'+ Listbox3.Items[N]);
        M := M+1;
        Excel.Cells[1,M].Value := Copy(Listbox3.Items[N],1,Length(Listbox3.Items[N])-4);
        For P := 1 to SGBesucher.RowCount -1 do
          If SGBesucher.Cells[0,P] = Copy(Listbox3.Items[N],1,Length(Listbox3.Items[N])-4) then
              Excel.Cells[2,M].Value := SGBesucher.Cells[4,P];

        for K := 0 to Listbox2.Count - 1 do
        begin
          for L := 1 to StringGrid3.RowCount - 1 do
          begin
            If StringGrid3.Cells[0,L] = Listbox2.Items[K] then
              Excel.Cells[L+2,M].Value := 'x';
          end;
        end;
        end;
    Speicherort := Excelspeichern.FileName;
    Excel.ActiveWorkbook.SaveAs(Speicherort);
    Excel.Quit;
    Excel := Unassigned;
end;
end;
Hab aber keinen Ansatz, wie ich die erste Zeile immer in Fett umändern kann und die ganzen "x" sollten eine andere Farbe (Rot) haben.
  Mit Zitat antworten Zitat