📄 qexport4xls.pas
字号:
TxlsItemType = (itFormat, itFieldFormat, itNoteFormat, itHyperlink,
itNote, itChart, itSeries, itPicture, itImage, itGraphic, itCell,
itMergedCells);
TxlsCustomItem = class(TCollectionItem)
private
FTag: integer;
protected
function GetItemType: TxlsItemType; virtual; abstract;
public
constructor Create(Collection: TCollection); override;
property ItemType: TxlsItemType read GetItemType;
property Tag: integer read FTag write FTag;
end;
TxlsFormat = class(TxlsCustomItem)
private
FFont: TxlsFont;
FBorders: TxlsBorders;
FFill: TxlsFill;
FAlignment: TxlsAlignment;
FWrap: boolean;
FRotation: Byte;
FFieldName: string;
procedure SetFont(Value: TxlsFont);
procedure SetBorders(const Value: TxlsBorders);
procedure SetFill(const Value: TxlsFill);
procedure SetAlignment(const Value: TxlsAlignment);
function IsDefault: boolean;
protected
function GetItemType: TxlsItemType; override;
function GetDisplayName: string; override;
procedure LoadFromTxlsXFormat(XFormat: TxlsXFormat);
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
function IsEqual(Format: TxlsFormat): boolean;
procedure SetDefault; virtual;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string); virtual;
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string); virtual;
published
property Font: TxlsFont read FFont write SetFont;
property Borders: TxlsBorders read FBorders write SetBorders;
property Fill: TxlsFill read FFill write SetFill;
property Alignment: TxlsAlignment read FAlignment write SetAlignment;
property Wrap: boolean read FWrap write FWrap default false;
property Rotation: Byte read FRotation write FRotation default 0;
property FieldName: string read FFieldName write FFieldName;
end;
TxlsFormats = class(TCollection)
private
FHolder: TPersistent;
protected
function GetOwner: TPersistent; override;
function GetItem(Index: integer): TxlsFormat;
procedure SetItem(Index: integer; Value: TxlsFormat);
public
constructor Create(Holder: TPersistent);
function Add: TxlsFormat;
function IsEqual(Formats: TxlsFormats): boolean;
procedure SaveToIniFile(IniFile: TQIniFile; const SectionPrefix: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const SectionPrefix: string);
property Holder: TPersistent read FHolder;
property Items[Index: integer]: TxlsFormat read GetItem
write SetItem; default;
end;
TxlsFieldFormat = class(TxlsFormat)
private
FWidth: integer;
FAggregate: TxlsAggregate;
protected
function GetItemType: TxlsItemType; override;
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
procedure Assign(Source: TPersistent); override;
procedure SetDefault; override;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string); override;
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string); override;
published
property Width: integer read FWidth write FWidth default 0;
property Aggregate: TxlsAggregate read FAggregate
write FAggregate default aggNone;
end;
TxlsFieldFormats = class(TCollection)
private
FHolder: TPersistent;
protected
function GetOwner: TPersistent; override;
function GetItem(Index: integer): TxlsFieldFormat;
procedure SetItem(Index: integer; Value: TxlsFieldFormat);
public
constructor Create(Holder: TPersistent);
function Add: TxlsFieldFormat;
function IndexByName(const FieldName: string): integer;
procedure Assign(Source: TPersistent); override;
property Holder: TPersistent read FHolder;
property Items[Index: integer]: TxlsFieldFormat read GetItem
write SetItem; default;
end;
TxlsNoteFormat = class(TxlsCustomItem)
private
FAlignment: TxlsAlignment;
FBackgroundColor: TColor;
FForegroundColor: TColor;
FFillType: TxlsNoteFillType;
FFont: TxlsFont;
FTransparency: TxlsPercent;
FOrientation: TxlsOrientation;
//FPattern: TxlsNotePattern;
FGradient: TxlsNoteGradient;
procedure SetAlignment(const Value: TxlsAlignment);
procedure SetFont(const Value: TxlsFont);
protected
function GetItemType: TxlsItemType; override;
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure SetDefault;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string);
published
property Alignment: TxlsAlignment read FAlignment write SetAlignment;
property BackgroundColor: TColor read FBackgroundColor
write FBackgroundColor default $00E1FFFF;
property ForegroundColor: TColor read FForegroundColor
write FForegroundColor default $00E1FFFF;
property FillType: TxlsNoteFillType read FFillType
write FFillType default nftSolid;
property Font: TxlsFont read FFont write SetFont;
property Transparency: TxlsPercent read FTransparency
write FTransparency default 0;
property Orientation: TxlsOrientation read FOrientation
write FOrientation default xrtNoRotation;
//property Pattern: TxlsNotePattern read FPattern
//write FPattern default npt5Percents;
property Gradient: TxlsNoteGradient read FGradient
write FGradient default ngrHorizontal;
end;
TxlsHyperlink = class(TxlsCustomItem)
private
FCol: word;
FFormat: TxlsFormat;
FHolder: TPersistent;
FRow: word;
FTarget: WideString;
FTitle: WideString;
FScreenTip: WideString;
FStyle: TxlsHyperlinkStyle;
function GetSize: integer;
function GetShortTarget: string;
procedure SetFormat(const Value: TxlsFormat);
function IsValid: boolean;
protected
function GetItemType: TxlsItemType; override;
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string);
property Size: integer read GetSize;
property ShortTarget: string read GetShortTarget;
published
property Col: word read FCol
write FCol default 0; // 1 based
property Format: TxlsFormat read FFormat write SetFormat;
property Row: word read FRow
write FRow default 0; // 1 based
property Style: TxlsHyperlinkStyle read FStyle
write FStyle default hlsURL;
property Target: WideString read FTarget write FTarget;
property Title: WideString read FTitle write FTitle;
property ScreenTip: WideString read FScreenTip write FScreenTip;
end;
TxlsHyperlinks = class(TCollection)
private
FHolder: TPersistent;
protected
function GetOwner: TPersistent; override;
function GetItem(Index: integer): TxlsHyperlink;
procedure SetItem(Index: integer; Value: TxlsHyperlink);
public
constructor Create(Holder: TPersistent);
function Add: TxlsHyperlink;
property Holder: TPersistent read FHolder;
property Items[Index: integer]: TxlsHyperlink read GetItem
write SetItem; default;
end;
TxlsNote = class(TxlsCustomItem)
private
FHolder: TPersistent;
FRow: word;
FCol: word;
FLines: TStrings;
FFormat: TxlsNoteFormat;
procedure SetLines(const Value: TStrings);
procedure SetFormat(const Value: TxlsNoteFormat);
function GetAnchor: TMSO_Anchor;
function IsValid: boolean;
protected
function GetItemType: TxlsItemType; override;
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string);
published
property Row: word read FRow
write FRow default 0; // 1 based
property Col: word read FCol
write FCol default 0; // 1 based
property Lines: TStrings read FLines write SetLines;
property Format: TxlsNoteFormat read FFormat write SetFormat;
end;
TxlsNotes = class(TCollection)
private
FHolder: TPersistent;
protected
function GetOwner: TPersistent; override;
function GetItem(Index: integer): TxlsNote;
procedure SetItem(Index: integer; Value: TxlsNote);
public
constructor Create(Holder: TPersistent);
function Add: TxlsNote;
property Holder: TPersistent read FHolder;
property Items[Index: integer]: TxlsNote read GetItem
write SetItem; default;
end;
TxlsDataRange = class(TPersistent)
private
FCol1: byte;
FCol2: byte;
FRow1: word;
FRow2: word;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string);
published
property Col1: byte read FCol1 write FCol1 default 0;
property Col2: byte read FCol2 write FCol2 default 0;
property Row1: word read FRow1 write FRow1 default 0;
property Row2: word read FRow2 write FRow2 default 0;
end;
TxlsRangeType = (rtColumn, rtCustom);
TxlsChartSeries = class(TxlsCustomItem)
private
FColor: TxlsColor;
FDataColumn: string;
FDataRange: TxlsDataRange;
FDataRangeType: TxlsRangeType;
FTitle: WideString;
procedure SetDataRange(const Value: TxlsDataRange);
protected
function GetItemType: TxlsItemType; override;
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
destructor Destroy; override;
procedure Assign(Source: TPersistent); override;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string);
published
property Color: TxlsColor read FColor write FColor default clrAqua;
property DataColumn: string read FDataColumn write FDataColumn;
property DataRange: TxlsDataRange read FDataRange write SetDataRange;
property DataRangeType: TxlsRangeType read FDataRangeType
write FDataRangeType default rtColumn;
property Title: WideString read FTitle write FTitle;
end;
TxlsChartSeriesList = class(TCollection)
private
FHolder: TPersistent;
protected
function GetOwner: TPersistent; override;
function GetItem(Index: integer): TxlsChartSeries;
procedure SetItem(Index: integer; Value: TxlsChartSeries);
public
constructor Create(Holder: TPersistent);
function Add: TxlsChartSeries;
property Holder: TPersistent read FHolder;
property Items[Index: integer]: TxlsChartSeries read GetItem
write SetItem; default;
end;
TxlsChartPositionType = (cptAuto, cptCustom);
TxlsChartPlacement = (cpBottom, cpRight);
TxlsChartAutoPosition = class(TPersistent)
private
FPlacement: TxlsChartPlacement;
FHeight: integer;
FLeft: integer;
FTop: integer;
FWidth: integer;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string);
published
property Placement: TxlsChartPlacement read FPlacement
write FPlacement default cpBottom;
property Height: integer read FHeight write FHeight default 10;
property Left: integer read FLeft write FLeft default 0;
property Top: integer read FTop write FTop default 0;
property Width: integer read FWidth write FWidth default 5;
end;
TxlsChartCustomPosition = class(TPersistent)
private
FX1: byte;
FX2: byte;
FY1: word;
FY2: word;
public
constructor Create;
procedure Assign(Source: TPersistent); override;
procedure SaveToIniFile(IniFile: TQIniFile; const Section: string);
procedure LoadFromIniFile(IniFile: TQIniFile; const Section: string);
published
property X1: byte read FX1 write FX1 default 0;
property X2: byte read FX2 write FX2 default 0;
property Y1: word read FY1 write FY1 default 0;
property Y2: word read FY2 write FY2 default 0;
end;
TxlsChartPosition = class(TPersistent)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -