You've already forked lazarus-ccr
fpspreadsheet: Load images for header/footer into workbook's embedded streams list.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4531 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -49,10 +49,10 @@ type
|
||||
procedure Assign(ASource: TsPageLayout);
|
||||
|
||||
{ Images embedded in header and/or footer }
|
||||
procedure AddHeaderImage(ASection: TsHeaderFooterSection;
|
||||
const AFilename: String);
|
||||
procedure AddFooterImage(ASection: TsHeaderFooterSection;
|
||||
const AFilename: String);
|
||||
procedure AddHeaderImage(AHeaderIndex: Integer;
|
||||
ASection: TsHeaderFooterSection; const AFilename: String);
|
||||
procedure AddFooterImage(AFooterIndex: Integer;
|
||||
ASection: TsHeaderFooterSection; const AFilename: String);
|
||||
|
||||
{ Repeated rows and columns }
|
||||
function HasRepeatedCols: Boolean;
|
||||
@ -248,30 +248,42 @@ begin
|
||||
FPrintranges[i] := ASource.FPrintRanges[i];
|
||||
end;
|
||||
|
||||
procedure TsPageLayout.AddHeaderImage(ASection: TsHeaderFooterSection;
|
||||
const AFilename: String);
|
||||
procedure TsPageLayout.AddHeaderImage(AHeaderIndex: Integer;
|
||||
ASection: TsHeaderFooterSection; const AFilename: String);
|
||||
var
|
||||
book: TsWorkbook;
|
||||
idx: Integer;
|
||||
begin
|
||||
if FWorksheet = nil then
|
||||
raise Exception.Create('[TsPageLayout.AddHeaderImage] Worksheet is nil.');
|
||||
book := TsWorksheet(FWorksheet).Workbook;
|
||||
idx := book.FindEmbeddedStream(AFilename);
|
||||
if idx = -1 then
|
||||
begin
|
||||
idx := book.AddEmbeddedStream(AFilename);
|
||||
book.GetEmbeddedStream(idx).LoadFromFile(AFileName);
|
||||
end;
|
||||
FHeaderImages[ASection].Index := idx;
|
||||
FHeaders[AHeaderIndex] := FHeaders[AHeaderIndex] + '&G';
|
||||
end;
|
||||
|
||||
procedure TsPageLayout.AddFooterImage(ASection: TsHeaderFooterSection;
|
||||
const AFileName: String);
|
||||
procedure TsPageLayout.AddFooterImage(AFooterIndex: Integer;
|
||||
ASection: TsHeaderFooterSection; const AFileName: String);
|
||||
var
|
||||
book: TsWorkbook;
|
||||
idx: Integer;
|
||||
begin
|
||||
if FWorksheet = nil then
|
||||
raise Exception.Create('[TsPageLayout.AddFooterImage] Worksheet is nil.');
|
||||
book := TsWorksheet(FWorksheet).Workbook;
|
||||
idx := book.FindEmbeddedStream(AFilename);
|
||||
if idx = -1 then
|
||||
begin
|
||||
idx := book.AddEmbeddedStream(AFilename);
|
||||
book.GetEmbeddedStream(idx).LoadFromFile(AFileName);
|
||||
end;
|
||||
FFooterImages[ASection].Index := idx;
|
||||
FFooters[AFooterIndex] := FFooters[AFooterIndex] + '&G';
|
||||
end;
|
||||
|
||||
{@@ ----------------------------------------------------------------------------
|
||||
|
@ -3423,11 +3423,12 @@ end;
|
||||
@param ARow Index of the row at which the image begins (top edge)
|
||||
@param ACol Index of the column at which the image begins (left edge)
|
||||
@param AFileName Name of the image file
|
||||
@param AOffsetX The image is offset horizontally by this pixel count from
|
||||
the left edge of the anchor cell. May reach into another
|
||||
cell.
|
||||
@param AOffsetY The image is offset vertically by this pixel count from the
|
||||
top edge of the anchor cell. May reach into another cell.
|
||||
@param AOffsetX The image is offset horizontally from the left edge of
|
||||
the anchor cell. May reach into another cell.
|
||||
Value is in millimeters.
|
||||
@param AOffsetY The image is offset vertically from the top edge of the
|
||||
anchor cell. May reach into another cell.
|
||||
Value is in millimeters.
|
||||
@param AScaleX Horizontal scaling factor of the image
|
||||
@param AScaleY Vertical scaling factor of the image
|
||||
@return Index into the internal image list.
|
||||
|
@ -658,15 +658,15 @@ type
|
||||
{ Index of format record in the workbook's FCellFormatList }
|
||||
FormatIndex: Integer;
|
||||
{ Cell content }
|
||||
UTF8StringValue: String; // Strings cannot be part of a variant record
|
||||
RichTextParams: TsRichTextParams; // Formatting of individual text ranges
|
||||
FormulaValue: String;
|
||||
UTF8StringValue: String; // Strings cannot be part of a variant record
|
||||
RichTextParams: TsRichTextParams; // Formatting of individual text ranges
|
||||
FormulaValue: String; // Formula for calculation of cell content
|
||||
case ContentType: TCellContentType of // variant part must be at the end
|
||||
cctEmpty : (); // has no data at all
|
||||
cctFormula : (); // FormulaValue is outside the variant record
|
||||
cctNumber : (Numbervalue: Double);
|
||||
cctUTF8String : (); // UTF8StringValue is outside the variant record
|
||||
cctDateTime : (DateTimevalue: TDateTime);
|
||||
cctDateTime : (DateTimeValue: TDateTime);
|
||||
cctBool : (BoolValue: boolean);
|
||||
cctError : (ErrorValue: TsErrorValue);
|
||||
end;
|
||||
@ -676,16 +676,16 @@ type
|
||||
|
||||
{@@ Embedded image }
|
||||
TsImage = record
|
||||
Row, Col: Cardinal;
|
||||
Index: Integer;
|
||||
OffsetX, OffsetY: Double; // mm
|
||||
ScaleX, ScaleY: Double;
|
||||
Row, Col: Cardinal; // cell for top/left edge of the image (anchor)
|
||||
Index: Integer; // index into the workbook's embedded streams list
|
||||
OffsetX, OffsetY: Double; // mm, relative to anchor
|
||||
ScaleX, ScaleY: Double; // scaling factor of image
|
||||
end;
|
||||
PsImage = ^TsImage;
|
||||
|
||||
{@@ Image embedded in header or footer}
|
||||
TsHeaderFooterImage = record
|
||||
Index: Integer;
|
||||
Index: Integer; // index into the workbook's embedded streams list
|
||||
end;
|
||||
|
||||
{@@ Page orientation for printing }
|
||||
|
Reference in New Issue
Block a user