Board index » delphi » Wheare are an example with TExcelApplication , TExcelWorkbook and TExcelWorksheet ?
Carl
Delphi Developer |
Carl
Delphi Developer |
Wheare are an example with TExcelApplication , TExcelWorkbook and TExcelWorksheet ? |
David
Delphi Developer |
2003-10-18 05:43:50 AM
Re:Wheare are an example with TExcelApplication , TExcelWorkbook and TExcelWorksheet ?
"Carl" <XXXX@XXXXX.COM>writes:
QuoteThank you It is a server for excel using Excel97.pas in Delphi 7 to support older versions of office as well. here is the interface TExcelServer = class private { Private-Deklarationen } FOwner : TComponent; FLCID : Integer; FConnected : boolean; ExcelApplication : TExcelApplication; ExcelWorkbook : TExcelWorkbook; ExcelWorksheet : TExcelWorksheet; ExcelPivotTable : PivotTable; ExcelPivotFields : TStringList; ExcelChart : TExcelChart; // allgemein --------------------------------------------------------------- procedure AutoFitColumn(Col : integer); procedure SetColumnWidth(Col, Width : integer); procedure PageBreakH(Row : integer); procedure PageBreakV(Col : integer); procedure MacroRun(Name: string); overload; procedure MacroRun(Name: string; Args: TStringList); overload; // Maximal 18 Argumente Rest wird ignoriert procedure MacroSet(Macro : TStringList); // Workbook ---------------------------------------------------------------- procedure WorkbookNew(Template: xlWBATemplate = xlWBATWorksheet); // Worksheet --------------------------------------------------------------- procedure WorksheetNew(Template: xlWBATemplate = xlWBATWorksheet); // Zellen ----------------------------------------------------------------- function TranslateCell(Row, Col : integer) : string; // übersetzt Row, Col in, für Excel verständliche "Zellenadresse" procedure TranslateRange(fromRow, fromCol, toRow, toCol : integer; var FromCell, ToCell : string); // übersetzt Row, Col in, für Excel verständliche "Zellenadresse" // Spalten ----------------------------------------------------------------- function TranslateColumn(Col : integer) : string; // Properties -------------------------------------------------------------- function GetConnected : boolean; function GetVisible : boolean; function GetWorksheetList : TStrings; procedure SetConnected(const Value : boolean); procedure SetVisible (const Value : boolean); public { Public-Deklarationen } constructor Create(AOwner : TComponent); destructor Destroy; override; // allgemein --------------------------------------------------------------- function IsRegistered : boolean; procedure CloseExcel; procedure OpenExcel; procedure OpenFile(sFileName : string); procedure NewFile; procedure Run(MacroName : string); overload; procedure Run(MacroName : string; Argumente : TStringList); overload; procedure InsertMacro(Text : TStringList); procedure PivotSet(Source, SheetName : string; fromRowSource, fromColSource, toRowSource, toColSource, fromRowDest, fromColDest, toRowDest, toColDest : integer); procedure PivotTest; procedure PivotFieldFunction(Field : string; F : xlConsolidationFunction); procedure ChartTest; // Workbook ---------------------------------------------------------------- procedure SaveActiveWorkbookAs(sFileName : string); procedure SaveActiveWorkbook; // Worksheet --------------------------------------------------------------- procedure WorksheetConnect(Name : string); procedure WorksheetAdd(Name : string; Template: xlWBATemplate = xlWBATWorksheet); procedure WorksheetRename(OldName, NewName : string); overload; procedure WorksheetRename(NewName : string); overload; // Zellen ----------------------------------------------------------------- function ReadCell(Row, Col : integer) : String; // liest den Wert der Zelle bei [Row, Col] aus procedure WriteCell(Row, Col : integer; sValue : String); // schreibt sValue in die Zelle bei [Row, Col] procedure WriteRow(Row, Col : integer; sValues : array of String); overload; // schreibt sValue in die Zeile Row beginnend mit Col bis zum Ende von sValue procedure WriteRow(Row, Col : integer; sValues : TStringList); overload; // schreibt sValue in die Zeile Row beginnend mit Col bis zum Ende von sValue procedure WriteRange(Row, Col : integer; sValues : TStringList; ColCount : integer); // schreibt sValue in die Zellen beginnend mit [Row, Col] bis zum Ende von sValue // wobei nach ColCount Zellen eine neue Zeile angefangen wird // die letzte Spalte mu?dabei nicht vollständig sein procedure DeleteCell(Row, Col : integer; Shift : XlDeleteShiftDirection); procedure DeleteRow(Row : integer); procedure DeleteColumn(Col : integer); procedure DeleteRange(fromRow, fromCol, toRow, toCol : integer; Shift : XlDeleteShiftDirection); // Properties -------------------------------------------------------------- property Visible : boolean read GetVisible write SetVisible; property Connected : boolean read GetConnected write SetConnected; property WorksheetList : TStrings read GetWorksheetList; property PivotFieldList : TStringList read ExcelPivotFields; end; It is not finished, I have some problems with charts in excel. They are not doing what I want. Until then David |
Carl
Delphi Developer |
2003-10-22 10:58:56 AM
Re:Wheare are an example with TExcelApplication , TExcelWorkbook and TExcelWorksheet ?
Thank you David
Here I found a very easy example and run very fast clubdelphi.com/ejemplos/Dbf2Excel.zip but are in spanish |