AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Erzeugte Exceldatei speichern

Ein Thema von tylix · begonnen am 8. Apr 2005 · letzter Beitrag vom 11. Apr 2005
Antwort Antwort
tylix

Registriert seit: 9. Dez 2003
Ort: Sauerlach
40 Beiträge
 
Delphi 5 Enterprise
 
#1

Erzeugte Exceldatei speichern

  Alt 8. Apr 2005, 13:41
Hallo,

ich erzeuge hiermit eine Exceldatei, dies funktioniert aber auch,
jedoch möchte ich diese erzeugte Datei automatisch speichern.

Ich finde leider nicht die richtige Lösung such schon seit ca. 1 Std. find´s aber nicht.

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  excel: TExcelApplication;
  SaveChanges: OleVariant;
  wb: _WorkBook;

  ws: _WorkSheet;

  a,zl,i, lcid: Integer;
  ze,sp:integer;
  z, y,x: string ;


begin
    lcid := GetUserDefaultLCID;
    excel := TExcelApplication.Create(self);
    excel.Connect;
    WB := Excel.Workbooks.Add(EmptyParam, LCID);;
    excel.Visible[lcid] := True;
    excel.Cells.Item[1, 1].Value := 'Ident';
    Excel.Cells.Item[1, 1].Interior.Color := clGreen;
    excel.Cells.Item[1, 2].Value := 'PR_ANREDE';
    Excel.Cells.Item[1, 2].Interior.Color := clGreen;
    excel.Cells.Item[1, 3].Value := 'PR_NAMEGES';
    Excel.Cells.Item[1, 3].Interior.Color := clGreen;
    excel.Cells.Item[1, 4].Value := 'PR_CO';
    Excel.Cells.Item[1, 4].Interior.Color := clGreen;
    excel.Cells.Item[1, 5].Value := 'Strasse';
    Excel.Cells.Item[1, 5].Interior.Color := clGreen;
    excel.Cells.Item[1, 6].Value := 'PLZ';
    Excel.Cells.Item[1, 6].Interior.Color := clGreen;
    excel.Cells.Item[1, 7].Value := 'ORT';
    Excel.Cells.Item[1, 7].Interior.Color := clGreen;
    excel.Cells.Item[1, 8].Value := 'Briefanr';
    Excel.Cells.Item[1, 8].Interior.Color := clGreen;
    excel.Cells.Item[1, 9].Value := 'Brief';
    Excel.Cells.Item[1, 9].Interior.Color := clGreen;

end;
Wäre super wenn ihr mir dabei helfen könntet.

Danke euch.
  Mit Zitat antworten Zitat
Vjay

Registriert seit: 2. Dez 2003
Ort: Berlin/Eschede
481 Beiträge
 
Delphi 7 Professional
 
#2

Re: Erzeugte Exceldatei speichern

  Alt 8. Apr 2005, 14:29
WB.Save(...);
Wer später bremst ist eher tot.
  Mit Zitat antworten Zitat
tylix

Registriert seit: 9. Dez 2003
Ort: Sauerlach
40 Beiträge
 
Delphi 5 Enterprise
 
#3

Re: Erzeugte Exceldatei speichern

  Alt 8. Apr 2005, 14:33
hi,

ds habe ich schon probiert, nur sagt er mir dann missing .....,

möchte es z.b. unter c:\tylix.xls speichern
  Mit Zitat antworten Zitat
Benutzerbild von Boombuler
Boombuler

Registriert seit: 14. Mär 2003
Ort: Osnabrück
244 Beiträge
 
Delphi 2009 Professional
 
#4

Re: Erzeugte Exceldatei speichern

  Alt 11. Apr 2005, 12:57
Excel.ActiveWorkbook.SaveAs(Dateiname); Greetz
Boombuler
"Look at you, Hacker. A pathetic creature of meat and bone, panting and sweating as you run through my corridors. How can you challenge a perfect, immortal machine?"
SwapIt Highscore:
  Mit Zitat antworten Zitat
Benutzerbild von Tonic1024
Tonic1024

Registriert seit: 10. Sep 2003
Ort: Cuxhaven
559 Beiträge
 
RAD-Studio 2009 Ent
 
#5

Re: Erzeugte Exceldatei speichern

  Alt 11. Apr 2005, 13:22
Ich könnte noch folgendes anbieten:

Delphi-Quellcode:
  // Beenden und speichern
  [WorkBook].Close(true, Excelfile, EmptyParam, _lcid);
  
  // Beenden ohne speichern
  [WorkBook].Close(false);
Der erste Wert (Bool) steht dafür ob gesaved werden soll oder nicht.
Der Zweite ist dann der Dateiname mit Pfad. Fällt weg wenn nicht gespeichert werden soll.

Ganz nützlich wenn man die Instanz eh schließen will...

MfG

Tonic
Der frühe Vogel fängt den Wurm, richtig.
Aber wird nicht auch der frühe Wurm vom Vogel gefressen?
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:31 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