📄 mxexport.pas
字号:
FText: String;
FComma: String;
FTab: String;
FRTF: String;
FDIF: String;
FSYLK: String;
Public
Constructor Create; Virtual;
Published
Property HTML: String Read FHTML Write FHTML;
Property Excel: String Read FExcel Write FExcel;
Property Word: String Read FWord Write FWord;
Property Text: String Read FText Write FText;
Property Comma: String Read FComma Write FComma;
Property Tab: String Read FTab Write FTab;
Property RTF: String Read FRTF Write FRTF;
Property DIF: String Read FDIF Write FDIF;
Property SYLK: String Read FSYLK Write FSYLK;
End;
// ************************************************************************
// ************************************************************************
// ************************************************************************
TmxHTMLColors = Class( TPersistent )
Private
FBackground: TColor; // bgcolor in body section
FDefaultLink: TColor; // link in body section
FDefaultFontFace: String; // font face in body's font sections
FVisitedLink: TColor; // vlink in body section
FActiveLink: TColor; // alink in body section
FDefaultText: TColor; // text in body section
FTableFontColor: TColor; // font color in body's font sections
FTableFontFace: String; // font face in body's font sections
FTableBackground: TColor; // bgcolor in table section
FTableOddBackground: TColor; // bgcolor in table section, it will be used for odd row coloring
FHeaderBackground: TColor; // bgcolor in header's TR section
FHeadersFontColor: TColor; // color in header's font section
Protected
Procedure AssignTo( Dest: TPersistent ); Override;
Public
Constructor Create; Virtual;
Published
Property Background: TColor Read FBackground Write FBackground;
Property DefaultLink: TColor Read FDefaultLink Write FDefaultLink;
Property DefaultFontFace: String Read FDefaultFontFace Write FDefaultFontFace;
Property VisitedLink: TColor Read FVisitedLink Write FVisitedLink;
Property ActiveLink: TColor Read FActiveLink Write FActiveLink;
Property DefaultText: TColor Read FDefaultText Write FDefaultText;
Property TableFontColor: TColor Read FTableFontColor Write FTableFontColor;
Property TableFontFace: String Read FTableFontFace Write FTableFontFace;
Property TableBackground: TColor Read FTableBackground Write FTableBackground;
Property TableOddBackground: TColor Read FTableOddBackground Write FTableOddBackground;
Property HeaderBackground: TColor Read FHeaderBackground Write FHeaderBackground;
Property HeadersFontColor: TColor Read FHeadersFontColor Write FHeadersFontColor;
End;
// ************************************************************************
// ************************************************************************
// ************************************************************************
TmxRTFColors = Class( TPersistent )
Private
FTableBackground: TColor; // bgcolor in table section
FTableOddBackground: TColor; // bgcolor in table section, it will be used for odd row coloring
FHeaderBackground: TColor; // bgcolor in header's TR section
FDefaultFont: TFont;
FHeaderFont: TFont;
FTableFont: TFont;
Procedure SetDefaultFont( AValue: TFont );
Procedure SetHeaderFont( AValue: TFont );
Procedure SetTableFont( AValue: TFont );
Protected
Procedure AssignTo( Dest: TPersistent ); Override;
Public
Constructor Create; Virtual;
Destructor Destroy; Override;
Published
Property TableBackground: TColor Read FTableBackground Write FTableBackground;
Property TableOddBackground: TColor Read FTableOddBackground Write FTableOddBackground;
Property HeaderBackground: TColor Read FHeaderBackground Write FHeaderBackground;
Property DefaultFont: TFont Read FDefaultFont Write SetDefaultFont;
Property HeaderFont: TFont Read FHeaderFont Write SetHeaderFont;
Property TableFont: TFont Read FTableFont Write SetTableFont;
End;
// ************************************************************************
// ************************************************************************
// ************************************************************************
TmxHTMLOptions = Class( TPersistent )
Private
FOptions: TmxExportHTMLOptionSet;
FCustomColors: TmxHTMLColors;
FExtension: TmxHTMLExtension;
FTemplate: TmxHTMLColorTemplate;
FTitle: String;
Procedure SetCustomColors( AValue: TmxHTMLColors );
Public
Constructor Create; Virtual;
Destructor Destroy; Override;
Published
Property CustomColors: TmxHTMLColors Read FCustomColors Write SetCustomColors;
Property Extension: TmxHTMLExtension Read FExtension Write FExtension Default exHTML;
Property Options: TmxExportHTMLOptionSet Read FOptions Write FOptions;
Property Template: TmxHTMLColorTemplate Read FTemplate Write FTemplate;
Property Title: String Read FTitle Write FTitle;
End;
// ************************************************************************
// ************************************************************************
// ************************************************************************
TmxRTFOptions = Class( TPersistent )
Private
FTemplate: TmxRTFColorTemplate;
FCustomSettings: TmxRTFColors;
FCellWidth: Integer;
FOptions: TmxExportRTFOptionSet;
FTopMargin: Integer;
FBottomMargin: Integer;
FLeftMargin: Integer;
FRightMargin: Integer;
Procedure SetCustomSettings( AValue: TmxRTFColors );
Public
Constructor Create; Virtual;
Destructor Destroy; Override;
Published
Property Template: TmxRTFColorTemplate Read FTemplate Write FTemplate;
Property Options: TmxExportRTFOptionSet Read FOptions Write FOptions;
Property CustomSettings: TmxRTFColors Read FCustomSettings Write SetCustomSettings;
Property CellWidth: Integer Read FCellWidth Write FCellWidth;
Property TopMargin: Integer Read FTopMargin Write FTopMargin;
Property BottomMargin: Integer Read FBottomMargin Write FBottomMargin;
Property LeftMargin: Integer Read FLeftMargin Write FLeftMargin;
Property RightMargin: Integer Read FRightMargin Write FRightMargin;
End;
// ************************************************************************
// ************************************************************************
// ************************************************************************
{$IFNDEF NATIVEEXCEL_STANDARD}
TmxExportCellFormat = Class;
{$ENDIF}
TmxExcelOptions = Class( TPersistent )
Private
{$IFDEF NATIVEEXCEL_STANDARD}
FDefaultFont: TFont;
FHeaderFont: TFont;
FTableFont: TFont;
FExcelVersion: TmxExcelVersion;
FHeader: String;
FFooter: String;
FTopMargin: Double;
FBottomMargin: Double;
FLeftMargin: Double;
FRightMargin: Double;
{$ELSE}
FDefaultFont: TmxExcelFont;
FHeaderFormat: TmxExportCellFormat;
FTableFormat: TmxExportCellFormat;
FExcelVersion: TmxFileVersion;
FPageSetup: TmxExcelPageSetup;
FSummaryInfo: TmxSummaryInfo;
FCodepage: TmxExcelCodePage;
FCustomCodepage: Integer;
{$ENDIF}
FColumnWidth: Integer;
FOptions: TmxExportExcelOptionSet;
FProtected: Boolean;
{$IFDEF NATIVEEXCEL_STANDARD}
Procedure SetDefaultFont( AValue: TFont );
Procedure SetHeaderFont( AValue: TFont );
Procedure SetTableFont( AValue: TFont );
{$ELSE}
Procedure SetDefaultFont( AValue: TmxExcelFont );
{$ENDIF}
Protected
Procedure AssignTo( Dest: TPersistent ); Override;
Public
Constructor Create; Virtual;
Destructor Destroy; Override;
Published
Property Options: TmxExportExcelOptionSet Read FOptions Write FOptions;
Property ColumnWidth: Integer Read FColumnWidth Write FColumnWidth;
Property Protected: Boolean Read FProtected Write FProtected;
{$IFDEF NATIVEEXCEL_STANDARD}
Property Header: String Read FHeader Write FHeader;
Property Footer: String Read FFooter Write FFooter;
Property ExcelVersion: TmxExcelVersion Read FExcelVersion Write FExcelVersion Default xls50;
Property DefaultFont: TFont Read FDefaultFont Write SetDefaultFont;
Property HeaderFont: TFont Read FHeaderFont Write SetHeaderFont;
Property TableFont: TFont Read FTableFont Write SetTableFont;
Property TopMargin: Double Read FTopMargin Write FTopMargin;
Property BottomMargin: Double Read FBottomMargin Write FBottomMargin;
Property LeftMargin: Double Read FLeftMargin Write FLeftMargin;
Property RightMargin: Double Read FRightMargin Write FRightMargin;
{$ELSE}
Property ExcelVersion: TmxFileVersion Read FExcelVersion Write FExcelVersion Default fvExcel97;
Property DefaultFont: TmxExcelFont Read FDefaultFont Write SetDefaultFont;
Property PageSetup: TmxExcelPageSetup Read FPageSetup Write FPageSetup;
Property SummaryInfo: TmxSummaryInfo Read FSummaryInfo Write FSummaryInfo;
Property Codepage: TmxExcelCodePage Read FCodepage Write FCodepage Default cp1252_Latin1;
Property CustomCodepage: Integer Read FCustomCodepage Write FCustomCodepage Default 1252;
Property HeaderFormat: TmxExportCellFormat Read FHeaderFormat Write FHeaderFormat;
Property TableFormat: TmxExportCellFormat Read FTableFormat Write FTableFormat;
{$ENDIF}
End;
// ************************************************************************
// ************************************************************************
// ************************************************************************
TmxMessagesOptions = Class( TPersistent )
Private
FCaption: String;
FCopiedToClipboard: String;
FCreatedText: String;
FText: String;
FHeight: Integer;
FWidth: Integer;
FTrueText: String;
FFalseText: String;
FExportCaption: String;
FCancelCaption: String;
FSaveTitle: String;
FSelectFormat: String;
FExportToFile: String;
FViewOnly: String;
FDocumentFilter: TmxDocumentFilter;
Public
Constructor Create; Virtual;
Destructor Destroy; Override;
Published
Property Caption: String Read FCaption Write FCaption;
Property CopiedToClipboard: String Read FCopiedToClipboard Write FCopiedToClipboard;
Property CancelCaption: String Read FCancelCaption Write FCancelCaption;
Property CreatedText: String Read FCreatedText Write FCreatedText;
Property DocumentFilter: TmxDocumentFilter Read FDocumentFilter Write FDocumentFilter;
Property ExportCaption: String Read FExportCaption Write FExportCaption;
Property ExportToFile: String Read FExportToFile Write FExportToFile;
Property FalseText: String Read FFalseText Write FFalseText;
Property Height: Integer Read FHeight Write FHeight;
Property SaveTitle: String Read FSaveTitle Write FSaveTitle;
Property SelectFormat: String Read FSelectFormat Write FSelectFormat;
Property Text: String Read FText Write FText;
Property TrueText: String Read FTrueText Write FTrueText;
Property Width: Integer Read FWidth Write FWidth;
Property ViewOnly: String Read FViewOnly Write FViewOnly;
End;
// ************************************************************************
// ************************************************************************
// ************************************************************************
TmxCustomExport = Class( TComponent )
Private
frm_ProgressForm: Tfrm_ProgressForm;
frm_Selection: Tfrm_Selection;
FCaptions: TStrings;
FColumnWidths: TStrings;
FExportTypes: TmxExportTypeSet;
FExportType: TmxExportType;
FFileName: String;
FHTML: TmxHTMLOptions;
FDOC_RTF: TmxRTFOptions;
FEXCEL: TmxExcelOptions;
FRTFStream: TMemoryStream;
FExportStyle: TmxExportStyle;
FTempDirectory: String;
FOptions: TmxExportOptionSet;
FMessages: TmxMessagesOptions;
FTruncateSymbol: String;
FRowNumberFormat: String;
FDateFormat: String;
FTimeFormat: String;
FDateTimeFormat: String;
FVersion: Integer;
FmxNativeExcel: TmxNativeExcel;
FExportedRowNumber: Integer;
FOnBeginExport: TNotifyEvent;
FOnEndExport: TNotifyEvent;
FOnGetHeader: TEventOnGetHeader;
FOnGetFooter: TEventOnGetFooter;
FOnError: TEventOnError;
FOnGetExtension: TEventOnGetExtension;
FOnExport: TEventOnExport;
FOnFileExist: TEventOnFileExist;
FRecordCount: Integer;
Procedure SetVersion( AValue: String );
Function GetVersion: String;
Procedure SetCaptions( AValue: TStrings );
Procedure SetColumnWidths( AValue: TStrings );
Procedure SetNumberFormat( AValue: String );
Procedure SetExportType( AValue: TmxExportType );
Procedure SetExportTypes( AValues: TmxExportTypeSet );
Procedure SetTempDirectory( AValue: String );
// *** RTF Support ***
Function GetRTFFont( Index: Integer; Font: TFont ): String;
Function GetRTFColor( ColorType: TmxRTFColor ): TColor;
Function GetRTFColorDefinition( ColorType: TmxRTFColor ): String;
Function GetRTFFontInfo( Font: TFont ): String;
// *** HTML Support ***
Function GetHTMLColor( ColorType: TmxHTMLColor ): String;
Function GetHTMLFontFace( FontType: TmxHTMLFont ): String;
Function IsTempStored: Boolean;
Protected
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -