AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi Excel Tabelle mit Diagramm erstellen??? D3 Prof.

Excel Tabelle mit Diagramm erstellen??? D3 Prof.

Ein Thema von EDatabaseError · begonnen am 16. Jun 2006 · letzter Beitrag vom 16. Jun 2006
Antwort Antwort
EDatabaseError

Registriert seit: 11. Mai 2005
Ort: Göppingen
1.238 Beiträge
 
Delphi 2007 Professional
 
#1

Excel Tabelle mit Diagramm erstellen??? D3 Prof.

  Alt 16. Jun 2006, 10:46
Also...ich will aus Delphi eine Excel Tabelle mit Diagramm erzeugen. Geht das???

Um grundlegendes zu erstellen hab ich das gefunden:
Delphi-Quellcode:
unit main;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, Xls;

type
  TfrmMain = class(TForm)
    btnMakeXls: TButton;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    procedure btnMakeXlsClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmMain: TfrmMain;

implementation

{$R *.DFM}

procedure TfrmMain.btnMakeXlsClick(Sender: TObject);
Var
  FileHandle : Integer;
  FileNameStr : String;
begin
  FileNameStr := ExtractFilePath(Application.ExeName) + 'Delphi.xls';
  FileHandle := Xls_Create(FileNameStr);

  Xls_SetFormat(FileHandle,'yyyy-mm-dd hh:mm:ss'); // user defined additional format 21

  // Xls_SetProtection(FileHandle, True); // protect entire worksheet
  // Xls_SetAttributeByte1(True, True); // Hidden, Locked -> only works if sheet is protected

  // some titles in the first column
  Xls_SetString(FileHandle, 0, 0, 'A random string :)');
  Xls_SetString(FileHandle, 1, 0, 'A lucky integer');
  Xls_SetString(FileHandle, 2, 0, 'Pi (in a box) - yuk :)');
  Xls_SetString(FileHandle, 3, 0, 'Today :');

  Xls_SetString(FileHandle, 0, 1, 'Hello World'); // couldn't resist the temptation
  Xls_SetInteger(FileHandle, 1, 1, 13); // integer : lucky 13

  Xls_SetAttributeByte3(False, True, True, True, True, 0); // show all borders
  Xls_SetDouble(FileHandle, 2, 1, Pi); // pi = double = 3.141572...
  Xls_SetAttributeByte3(False, False, False, False, False, 0); // reset

  Xls_SetAttributeByte2(0, 21); // use user defined format 21
  Xls_SetDouble(FileHandle, 3, 1, Now); // datetime
  Xls_SetAttributeByte2(0, 0); // reset

  Xls_SetColWidth(FileHandle, 0, 17); // set column width
  Xls_SetColWidth(FileHandle, 1, 25); // set column width

  Xls_Close (FileHandle); // closing stuff

  ShowMessage('done');
end;

end.
Mfg
Tobi
Tobias
It's not a bug, it's a feature.
  Mit Zitat antworten Zitat
EDatabaseError

Registriert seit: 11. Mai 2005
Ort: Göppingen
1.238 Beiträge
 
Delphi 2007 Professional
 
#2

Re: Excel Tabelle mit Diagramm erstellen??? D3 Prof.

  Alt 16. Jun 2006, 18:38
*push*

Das was da oben ist läuft nur mit D2005 auf meinem D3 kennt er die Unit Xls nicht.
Tobias
It's not a bug, it's a feature.
  Mit Zitat antworten Zitat
mkinzler
(Moderator)

Registriert seit: 9. Dez 2005
Ort: Heilbronn
39.851 Beiträge
 
Delphi 11 Alexandria
 
#3

Re: Excel Tabelle mit Diagramm erstellen??? D3 Prof.

  Alt 16. Jun 2006, 18:55
Späte Bindung der com-Objekte funktioniert aber auf jedenfall, man muß halt auf die Autovervollständigung der IDE verzichten.
Delphi-Quellcode:
var
    excel: OleVariant;
..
begin
   ...
   excel := CreateOleObject( 'Excel.Application');
Markus Kinzler
  Mit Zitat antworten Zitat
EDatabaseError

Registriert seit: 11. Mai 2005
Ort: Göppingen
1.238 Beiträge
 
Delphi 2007 Professional
 
#4

Re: Excel Tabelle mit Diagramm erstellen??? D3 Prof.

  Alt 16. Jun 2006, 18:58
sry aber versteh ich nicht...
Tobias
It's not a bug, it's a feature.
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

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 18:06 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