Unit: lxHandleX
TXLSXHeaderFooterImages is the typed image collection exposed by TXLSXWorksheet.HeaderFooterImages
每種頁面類型在頁首與頁尾都支援左、中、右三張圖片,合計十八個獨立的圖片插槽
Declarations
type
TXLSXHeaderFooterPageKind = (
xlsxHFOddPage, xlsxHFEvenPage, xlsxHFFirstPage);
TXLSXHeaderFooterPicturePosition = (
xlsxHFLeftHeader, xlsxHFCenterHeader, xlsxHFRightHeader,
xlsxHFLeftFooter, xlsxHFCenterFooter, xlsxHFRightFooter);
TXLSXHeaderFooterImage = class
property PageKind: TXLSXHeaderFooterPageKind;
property Position: TXLSXHeaderFooterPicturePosition;
property WidthPt, HeightPt: Double;
property MarginLeftPt, MarginTopPt: Double;
property Format: TXLSXImageFormat;
property Data: AnsiString;
property Title: WideString;
end;
TXLSXHeaderFooterImages = class
function Add(APageKind: TXLSXHeaderFooterPageKind;
APosition: TXLSXHeaderFooterPicturePosition): TXLSXHeaderFooterImage; overload;
function AddFromFile(APageKind: TXLSXHeaderFooterPageKind;
APosition: TXLSXHeaderFooterPicturePosition;
const AFileName: WideString): TXLSXHeaderFooterImage;
function Find(APageKind: TXLSXHeaderFooterPageKind;
APosition: TXLSXHeaderFooterPicturePosition): TXLSXHeaderFooterImage;
function Delete(APageKind: TXLSXHeaderFooterPageKind;
APosition: TXLSXHeaderFooterPicturePosition): Boolean; overload;
procedure Clear;
property Count: Integer;
property Items[Index: Integer]: TXLSXHeaderFooterImage; default;
end;
Behaviour
Add reuses the selected slot and inserts the required &G field into the matching header or footer section
- Even-page and first-page images automatically enable
DifferentOddEven and DifferentFirst
AddFromFile accepts PNG, JPEG, GIF, BMP, EMF, and WMF payloads
- 開啟與儲存時會保留圖片位元組、格式、標題、點數尺寸、點數邊界,以及由 relationship 持有的 VML 繪圖
- 頁首與頁尾圖片繪圖和同一張工作表上的儲存格註解繪圖彼此獨立
Delete and Clear 會移除對應的圖片功能變數代碼,同時保留其他不相干的頁首頁尾文字
Example
var
Image: TXLSXHeaderFooterImage;
begin
Image := Sheet.HeaderFooterImages.AddFromFile(
xlsxHFOddPage, xlsxHFLeftHeader, 'logo.png');
Image.WidthPt := 86;
Image.HeightPt := 42;
Sheet.HeaderFooterImages.AddFromFile(
xlsxHFEvenPage, xlsxHFCenterFooter, 'confidential.png');
end;
See also