-
-
Notifications
You must be signed in to change notification settings - Fork 36
setHeaderImage
Julian Halliwell edited this page Sep 20, 2021
·
4 revisions
Adds an image to a spreadsheet print header.
setHeaderImage( workbook=workbook, position, image ); // file path
setHeaderImage( workbook=workbook, position, image, imageType ); // object
-
workbook
spreadsheet object -
position
string where to place the image in the header. Possible values:left
orl
,center
orcentre
orc
,right
orr
-
image
EITHER string: absolute path to the image file, OR image object: a CFML image object -
imageType
(only required ifimage
is a CFML image object): string: Possible values:dib
,emf
,jpeg
,jpg
,pict
,png
,wmf
Chainable? Yes.
- You can only add header and footer images to XLSX files (i.e. Microsoft's XML format).
- You cannot add header/footer images to an existing spreadsheet which already has one or more header/footer images.
- Images may only appear when using Microsoft Excel. They are not supported in LibreOffice or Google Sheets.
spreadsheet = New spreadsheet();
workbook = spreadsheet.newXlsx();
spreadsheet.addRow( workbook, [ "a", "b", "c", "d", "e" ] );
imagePath = ExpandPath( "blue.jpg" );
spreadsheet.setHeaderImage( workbook, "centre", imagePath );
spreadsheet.setSheetTopMargin( workbook, 2 );
spreadsheet.write( workbook, ExpandPath( "text.xlsx" ), true );
spreadsheet = New spreadsheet();
workbook = spreadsheet.newXlsx();
spreadsheet.addRow( workbook, [ "a", "b", "c", "d", "e" ] );
imageObject = ImageRead( "https://docs.lucee.org/assets/images/lucee-logo-bw.png" );
spreadsheet.setHeaderImage( workbook, "left", imageObject , "png" );
spreadsheet.setSheetTopMargin( workbook, 3 );
spreadsheet.write( workbook, ExpandPath( "text.xlsx" ), true );