home *** CD-ROM | disk | FTP | other *** search
- unit DFlexCelReportEditor;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- {$IFDEF ConditionalExpressions}{$if CompilerVersion >= 14} //Delphi 6 or above
- DesignIntf, DesignEditors,
- {$IFEND}
- {$ELSE}
- DsgnIntf,
- {$ENDIF}
- UCustomFlexCelReport, UFlxMessages, UExcelEdit, UFlxDesignHelp, ShellAPI, ComObj;
-
- type
- TFlexCelReportEditor = class(TComponentEditor)
- private
- { Private declarations }
- protected
- { Protected declarations }
- public
- { Public declarations }
- function GetVerb(Index: Integer): String; override;
- function GetVerbCount: Integer; override;
- procedure ExecuteVerb(Index: Integer); override;
- published
- { Published declarations }
- end;
-
- procedure Register;
-
- implementation
- function TFlexCelReportEditor.GetVerbCount: Integer;
- begin
- Result := 3;
- end;
-
- function TFlexCelReportEditor.GetVerb(Index: Integer): String;
-
- begin
- case Index of
- 0: Result := 'Edit Report...';
- 1: Result := 'Open Report';
- 2: Result := 'About...';
- end;
- end;
-
-
- procedure TFlexCelReportEditor.ExecuteVerb(Index: Integer);
- var
- FName: string;
- begin
- chdir(ExtractFilePath(GetActiveProjectFileName));
- case Index of
- 0: InvokeExcelEditor((Component as TCustomFlexCelReport).DesignDataModule,(Component as TCustomFlexCelReport).Template, GetActiveProjectFileName);
- 1:
- begin
- try
- FName:=SearchPathStr((Component as TCustomFlexCelReport).Template);
- except
- on e:Exception do
- begin
- ShowMessage(format(ErrNoTemplate, [e.Message, GetActiveProjectFileName]));
- exit;
- end;
- end; //except
-
- ShellExecute( 0, 'open', PCHAR(FName), nil, nil, SW_SHOWMAXIMIZED);
- end;
-
- 2: ShowMessage(Format(MsgAbout,[FlexCelVersion]));
- end //case
- end;
-
- procedure Register;
- begin
- RegisterComponentEditor(TCustomFlexCelReport, TFlexCelReportEditor);
- end;
-
- end.
-