Font Class. Font instances belong to the workbook (see Fn'LibXL'GetFontCount and Fn'LibXL'GetFont in the Book Class functions). Each Font instance may be shared by any number of Format instances (which is how they get associated with cells). So the standard procedure for defining fonts involves using the Book class function Fn’LibXL’AddFont to create a font instance and add it to the book, then using the Font class function LibXL’FontSetAttributes to assign attributes to it. Or, you can combine these two steps using the Fn’LibXL’AddFont’SetAttributes function.
Function / Procedure |
Description |
LibXL'FontSetAttributes |
Set attributes for specified instance of font class |
Fn'LibXL'AddFont’SetAttributes |
Create font instance, add to book, set attributes for it |
Fn'LibXL'FontGetAttributes |
Get attributes of specified font instance. |
Format Class. Each cell (individually, or in rows or columns) is associated with a single instance of the Format class, which determines the non-data attributes for the cell (alignment, color, font, numeric format or mask, etc.). As with Fonts, the Format instances belong to the Book class, so the standard procedure for defining a Format would be to use the Book class function Fn’LibXL’AddFormat, and then pass the returned Format instance handle to the Format class procedure LibXL’FormatSetAttributes to assign the attributes of the format. Or, you can combine those two steps with the Fn’LibXL’AddFormat’SetAttributes function.
Also note the overuse of the word “format” to refer both to the Format class, as well as to number formats, either the standard built-in ones identified by NUMFMT_xxx identifiers, or custom ones you define via a mask. (We try to minimize the confusion by using the abbreviation “Fmt” when referring to the number formats, reserving “Format” to refer to the Format class.)
Custom numeric formats are also owned by the Book, and have to be created and added to the book before they can be associated with an instance of the Format class. Again you can perform those steps separately, starting with the Book class function Fn'LibXL'AddCustomNumFmt and Format class function Fn’LibXL’FormatSetNumFmt, or use the combined function Fn’LibXL’Format’AddSetCustomNumFmt.
Function / Procedure |
Description |
Fn'LibXL'FormatGetFont |
Return handle of font associated with specified format instance |
Fn'LibXL'FormatSetFont |
Set font for specified format instance |
Fn'LibXL'FormatGetNumFmtId |
Return numeric format id for specified format instance |
LibXL'FormatSetNumFmt |
Set numeric format for specified instance of format class |
Fn'LibXL'AddFormat'SetNumFmt |
Create format instance, add to book set numeric format for it |
Fn'LibXL'Format'AddSetCustomNumFmt |
Create custom numeric format, add to book, set specified format instance to use it |
LibXL'FormatSetAttributes |
Set attributes of specified format instance |
Fn'LibXL'AddFormat'SetAttributes |
Create format instance, add to book, set attributes for it |
LibXL'FormatGetAttributes |
Get attributes of specified format instance |
Fn'LibXL'FormatSetBorders |
Set borders for specified format instance |
Fn'LibXL'FormatGetBorders |
Get borders for specified format instance |
Misc Routines (not associated with a class):
Function / Procedure |
Description |
Fn'LibXL'Load |
Load the LibXL library |
Fn'LibXL'Unload |
Unload the library |
Fn'LibXL'Handle'DynLib'Errors |
Handle library errors related to the Dynamic library interface |
LibXL'Error |
Force/report a library logic error |
Fn'LibXL'Get'DLCTL$ |
Return the dynamic library control structure |
Fn'LibXL'Set'Flags |
Set overall library interface flags |