|
DOCUMENTS 5 - PortalScripting API
|
Page headers/footers in Excel are generated using a string which is a combination of plain text and control characters.
The available control characters are:
| Control | Category | Description |
|---|---|---|
&L | Justification | Left |
&C | Center | |
&R | Right | |
&P | Information | Page number |
&N | Total number of pages | |
&D | Date | |
&T | Time | |
&F | File name | |
&A | Worksheet name | |
&Z | Workbook path | |
&fontsize | Font | Font size |
&"font,style" | Font name and style | |
&U | Single underline | |
&E | Double underline | |
&S | Strikethrough | |
&X | Superscript | |
&Y | Subscript |
Text in headers and footers can be justified (aligned) to the left, center and right by prefixing the text with the control characters &L, &C and &R.
For example (with ASCII art representation of the results):
For simple text, if you do not specify any justification the text will be centered. However, you must prefix the text with &C if you specify a font name or any other formatting:
You can have text in each of the justification regions:
The information control characters act as variables that Excel will update as the Excel file or worksheet changes. Times and dates are in the users default format:
You can specify the font size of a section of the text by prefixing it with the control character &n where n is the font size:
You can specify the font of a section of the text by prefixing it with the control sequence &"font,style" where font is a font name such as "Courier New" or "Times New Roman" and style is one of the standard Windows font styles: "Regular", "Italic", "Bold" or "Bold Italic".
To include a single literal ampersand & in a header or footer you should use a double ampersand &&:
Note:
The header or footer string must be less than 255 characters. Strings longer than this will not be written.