Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
XL.Sheet.SetHeader
Sets the header text of the sheet when printed.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "XL.Sheet.SetHeader"; bookRef; sheetIndex; Text { ; Margin } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
bookRef | The reference to the workbook. Please use XL.LoadBook to load a file. | $ref | |
sheetIndex | The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. | 0 | |
Text | The new header text. | "test" | |
Margin | The margin to use. | 0.5 | Optional |
Result
Returns OK or error message.
Description
Sets the header text of the sheet when printed.The text appears at the top of every page when printed. The length of the text must be less than or equal to 255. The header text can contain special commands, for example a placeholder for the page number, current date or text formatting attributes. Special commands are represented by single letter with a leading ampersand ("&"). Margin is specified in inches.
Code | Description |
&L | specifies the beginning of the left section |
&P | specifies the current page number |
&N | specifies the total number of pages |
&\d{1,3} | specifies the text font size, where font size is measured in points, for example: &9 or &36 |
&S | specifies whether the strikethrough text style is on or off |
&X | specifies whether the superscript text style is on or off |
&Y | specifies whether the subscript text style is on or off |
&C | specifies the beginning of the center section |
&D | specifies a date |
&T | specifies a time |
&G | specifies a picture |
&U | specifies whether the single underline text style is on or off |
&E | specifies whether the double underline text style is on or off |
&R | specifies the beginning of the right section |
&Z | specifies a workbook file path |
&F | specifies a workbook file name |
&A | specifies a sheet name |
&"fontname" | specifies the text font, for example: &"Comic Sans MS" |
&B | specifies whether the bold text style is on or off |
&I | specifies whether the italic text style is on or off |
&& | specifies an ampersand character (&) |
Examples
Set sheet name:
MBS( "XL.Sheet.SetHeader"; $book; 0; "My Report 2019" )
See also
- XL.Book.SheetCount
- XL.LoadBook
- XL.Sheet.GetPaper
- XL.Sheet.GetVCenter
- XL.Sheet.SetFooter
- XL.Sheet.SetHCenter
- XL.Sheet.SetHidden
- XL.Sheet.SetMerge
- XL.Sheet.SetPaper
- XL.Sheet.SetVCenter
This function checks for a license.
Created 18th August 2014, last changed 16th May 2019