📄 qexport4dsgn.pas
字号:
2: Edit
else inherited ExecuteVerb(Index);
end;
end;
procedure TQExportHTMLEditor.Edit;
begin
inherited;
end;
{$IFDEF VCL6}
procedure TQExportHTMLEditor.EditProperty(const Prop: IProperty; var Continue: Boolean);
begin
if CompareText(Prop.GetName, 'HTMLTemplate') = 0 then begin
Prop.Edit;
Continue := False;
end;
end;
{$ELSE}
procedure TQExportHTMLEditor.EditProperty(PropertyEditor: TPropertyEditor;
var Continue, FreeEditor: boolean);
begin
if CompareText(PropertyEditor.GetName, 'HTMLTemplate') = 0 then begin
PropertyEditor.Edit;
Continue := false;
end;
end;
{$ENDIF}
{ TQXLSExportEdtor }
function TQExportXLSEditor.GetVerbCount: integer;
begin
Result := 2;
end;
function TQExportXLSEditor.GetVerb(Index: integer): string;
begin
case Index of
0: Result := 'Component editor...';
1: Result := '&About EMS QuickExport...';
end;
end;
procedure TQExportXLSEditor.ExecuteVerb(Index: integer);
begin
case Index of
0: if RunQExportXLSEditor(Component as TQExport4XLS, Designer)
then Designer.Modified;
1: ShowAboutForm;
end;
end;
procedure TQExportXLSEditor.Edit;
begin
ExecuteVerb(0);
end;
{ TQFileNameProperty }
procedure TQFileNameProperty.Edit;
var
OpenDialog: TOpenDialog;
begin
OpenDialog := TOpenDialog.Create(nil);
try
OpenDialog.Filter := GetFilter;
OpenDialog.DefaultExt := GetDefaultExt;
OpenDialog.FileName := GetStrValue;
if OpenDialog.Execute then
SetStrValue(OpenDialog.FileName);
finally
OpenDialog.Free;
end;
end;
function TQFileNameProperty.GetAttributes: TPropertyAttributes;
begin
Result := inherited GetAttributes + [paDialog];
end;
{ TQExcelFileNameProperty }
function TQExcelFileNameProperty.GetDefaultExt: string;
begin
Result := 'xls';
end;
function TQExcelFileNameProperty.GetFilter: string;
begin
Result := 'Microsoft Excel files (*.xls)|*.xls';
end;
{ TVRTFFileNameProperty }
function TQRTFFileNameProperty.GetDefaultExt: string;
begin
Result := 'doc';
end;
function TQRTFFileNameProperty.GetFilter: string;
begin
Result := 'Microsoft Word files (*.doc)|*.doc|RTF files (*.rtf)|*.rtf'
end;
{ TQHTMLFileNameProperty }
function TQHTMLFileNameProperty.GetDefaultExt: string;
begin
Result := 'html';
end;
function TQHTMLFileNameProperty.GetFilter: string;
begin
Result := 'HTML files (*.html, *.htm)|*.html;*.htm';
end;
{ TQLaTeXFileNameProperty }
function TQLaTeXFileNameProperty.GetDefaultExt: string;
begin
Result := 'tex';
end;
function TQLaTeXFileNameProperty.GetFilter: string;
begin
Result := 'LaTeX files (*.tex)|*.tex';
end;
{ TQASCIIFileNameProperty }
function TQASCIIFileNameProperty.GetDefaultExt: string;
var
QExport: TQExport4ASCII;
begin
QExport := GetComponent(0) as TQExport4ASCII;
case QExport.ExportType of
etTxt: Result := 'txt';
etCSV: Result := 'csv';
etDIF: Result := 'dif';
etSYLK: Result := 'slk';
end;
end;
function TQASCIIFileNameProperty.GetFilter: string;
var
QExport: TQExport4ASCII;
begin
QExport := GetComponent(0) as TQExport4ASCII;
case QExport.ExportType of
etTxt: Result := 'Text files (*.txt)|*.txt';
etCSV: Result := 'CSV files (*.csv)|*.csv';
etDIF: Result := 'DIF files (*.dif)|*.dif';
etSYLK: Result := 'SYLK files (*.slk)|*.slk';
end;
end;
{ TQCSSFileNameProperty }
function TQCSSFileNameProperty.GetDefaultExt: string;
begin
Result := 'css';
end;
function TQCSSFileNameProperty.GetFilter: string;
begin
Result := 'Cascading style sheets files (*.css)|*.css';
end;
{ TQSQLFileNameProperty }
function TQSQLFileNameProperty.GetDefaultExt: string;
begin
Result := 'sql';
end;
function TQSQLFileNameProperty.GetFilter: string;
begin
Result := 'SQL files (*.sql)|*.sql';
end;
{ TQAppFileNameProperty }
function TQAppFileNameProperty.GetDefaultExt: string;
begin
Result := 'exe';
end;
function TQAppFileNameProperty.GetFilter: string;
begin
Result := 'Executable files (*.exe)|*.exe';
end;
{ TQXMLFileNameProperty }
function TQXMLFileNameProperty.GetDefaultExt: string;
begin
Result := 'xml';
end;
function TQXMLFileNameProperty.GetFilter: string;
begin
Result := 'XML files (*.xml)|*.xml';
end;
{ TQXlsxFileNameProperty }
function TQXlsxFileNameProperty.GetDefaultExt: string;
begin
Result := 'xlsx';
end;
function TQXlsxFileNameProperty.GetFilter: string;
begin
Result := 'Microsoft Excel 2007 files (*.xlsx)|*.xlsx';
end;
{ TQDocxFileNameProperty }
function TQDocxFileNameProperty.GetDefaultExt: string;
begin
Result := 'docx';
end;
function TQDocxFileNameProperty.GetFilter: string;
begin
Result := 'Microsoft Word 2007 files (*.docx)|*.docx';
end;
{ TQDBFFileNameProperty }
function TQDBFFileNameProperty.GetDefaultExt: string;
begin
Result := 'dbf';
end;
function TQDBFFileNameProperty.GetFilter: string;
begin
Result := 'DBF files (*.dbf)|*.dbf';
end;
{ TQCFGFileNameProperty }
function TQCFGFileNameProperty.GetDefaultExt: string;
begin
Result := 'cfg';
end;
function TQCFGFileNameProperty.GetFilter: string;
begin
Result := 'Configurations files (*.cfg)|*.cfg';
end;
{ TQPDFFileNameProperty }
function TQPDFFileNameProperty.GetDefaultExt: string;
begin
Result := 'pdf';
end;
function TQPDFFileNameProperty.GetFilter: string;
begin
Result := 'PDF Document files (*.pdf)|*.pdf';
end;
{ TQPictureFileNameProperty }
function TQPictureFileNameProperty.GetDefaultExt: string;
begin
Result := 'bmp';
end;
function TQPictureFileNameProperty.GetFilter: string;
begin
Result := 'All Images (*.bmp;*.wmf;*.emf;*.jpg;*.jpeg;*.png;*.gif)|' +
'*.bmp;*.wmf;*.emf;*.jpg;*.jpeg;*.png;*.gif|' +
'Bitmaps (*.bmp)|*.bmp|' +
'Metafiles (*.wmf)|*.wmf|' +
'Enhanced Metafiles (*.emf)|*.emf|' +
'JPEG Image File (*.jpg)|*.jpg|' +
'JPEG Image File (*.jpeg)|*.jpeg|' +
'PNG Image (*.png)|*.png|' +
'GIF Image (*.gif)|*.gif';
end;
{ TQExportAboutProperty }
procedure TQExportAboutProperty.Edit;
begin
ShowAboutForm;
end;
function TQExportAboutProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paReadOnly, paDialog];
end;
function TQExportAboutProperty.GetValue: string;
begin
Result := S_ABOUT;
end;
{ TQExportVersionProperty }
procedure TQExportVersionProperty.Edit;
begin
ShowAboutForm;
end;
function TQExportVersionProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paReadOnly, paDialog];
end;
function TQExportVersionProperty.GetValue: string;
begin
Result := S_VERSION;
end;
{ TQExcelFieldNameProperty }
function TQExcelFieldNameProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paValueList]
end;
procedure TQExcelFieldNameProperty.GetValues(Proc: TGetStrProc);
var
WasInActive: Boolean;
Holder: TPersistent;
i: Integer;
PropInfo: PPropInfo;
ExportSource: TQExportSource;
DataSet: TDataSet;
DBGrid: TDBGrid;
ListView: TListView;
StringGrid: TStringGrid;
begin
Holder := (((GetComponent(0) as TxlsFieldFormat).Collection as TxlsFieldFormats).Holder);
PropInfo := TypInfo.GetPropInfo(Holder.ClassInfo, 'ExportSource');
if not Assigned(PropInfo) then Exit;
ExportSource := TQExportSource(TypInfo.GetOrdProp(Holder, PropInfo));
case ExportSource of
esDataSet: begin
PropInfo := TypInfo.GetPropInfo(Holder.ClassInfo, 'DataSet');
if not Assigned(PropInfo) then Exit;
DataSet := TDataSet(TypInfo.GetOrdProp(Holder, PropInfo));
if not Assigned(DataSet) then Exit;
WasInActive := not Dataset.Active;
if WasInActive then
try
Dataset.Open;
except
Exit;
end;
for i := 0 to DataSet.FieldCount - 1 do begin
Proc(DataSet.Fields[I].FieldName);
end;
if WasInActive then
try
Dataset.Close;
except
end;
end; //esDataSet
esDBGrid: begin
PropInfo := TypInfo.GetPropInfo(Holder.ClassInfo, 'DBGrid');
if not Assigned(PropInfo) then Exit;
DBGrid := TDBGrid(TypInfo.GetOrdProp(Holder, PropInfo));
if not Assigned(DBGrid) then Exit;
if DBGrid.Columns.Count > 0 then begin
for i := 0 to DBGrid.Columns.Count - 1 do begin
Proc(DBGrid.Columns[i].Title.Caption);
end;
end
else if Assigned(DBGrid.DataSource) and
Assigned(DBGrid.DataSource.DataSet) then begin
DataSet := DBGrid.DataSource.DataSet;
WasInActive := not Dataset.Active;
if WasInActive then
try
Dataset.Open;
except
Exit;
end;
for i := 0 to DataSet.FieldCount - 1 do begin
Proc(DataSet.Fields[I].FieldName);
end;
if WasInActive then
try
Dataset.Close;
except
end;
end;
end; //esDBGrid
esListView: begin
PropInfo := TypInfo.GetPropInfo(Holder.ClassInfo, 'ListView');
if not Assigned(PropInfo) then Exit;
ListView := TListView(TypInfo.GetOrdProp(Holder, PropInfo));
if not Assigned(ListView) then Exit;
for i := 0 to ListView.Columns.Count - 1 do begin
Proc(ListView.Columns[i].Caption);
end;
end;//esListView
esStringGrid: begin
PropInfo := TypInfo.GetPropInfo(Holder.ClassInfo, 'StringGrid');
if not Assigned(PropInfo) then Exit;
StringGrid := TStringGrid(TypInfo.GetOrdProp(Holder, PropInfo));
if not Assigned(StringGrid) then Exit;
for i := 0 to StringGrid.ColCount - 1 do begin
Proc(IntToStr(i));
end;
end;//esStringGrid;
end;
end;
{ TQExcelPictureNameProperty }
function TQExcelPictureNameProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paValueList]
end;
procedure TQExcelPictureNameProperty.GetValues(Proc: TGetStrProc);
var
// WasInActive: Boolean;
Holder: TPersistent;
i: integer;
PropInfo: PPropInfo;
// ExportSource: TQExportSource;
// DataSet: TDataSet;
// DBGrid: TDBGrid;
// ListView: TListView;
// StringGrid: TStringGrid;
Pictures: TxlsPictures;
begin
Holder := (((GetComponent(0) as TxlsImage).Collection as TxlsImages).Holder);
if Holder is TxlsSheet then
Holder := ((Holder as TxlsSheet).Collection as TxlsSheets).QExportXLS;
PropInfo := TypInfo.GetPropInfo(Holder.ClassInfo, 'Pictures');
if not Assigned(PropInfo) then Exit;
Pictures := TxlsPictures(TypInfo.GetOrdProp(Holder, PropInfo));
for i := 0 to Pictures.Count - 1 do
Proc(Pictures[i].Name);
{ ExportSource := TQExportSource(TypInfo.GetOrdProp(Holder, PropInfo));
case ExportSource of
esDataSet: begin
PropInfo := TypInfo.GetPropInfo(Holder.ClassInfo, 'DataSet');
if not Assigned(PropInfo) then Exit;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -