## The `format' property

Valid for: Image, Grid

#### Image object

Character Vector

For an Image object, the `format` property is a text string which indicates the graphics format used to store the image on disk. After you have called the `Load` method to read an image file, the `format` property will reflect the original format of the file, for example 'JPEG' or 'GIF'.

If you want to save the image in a different format, you can write a different string to the `format` property before calling the `Save` method.

The list of supported formats can be read from the `formats` property. However, some of these may be valid for reading only - see the ImageMagick documentation for more details.

#### Grid object

For the Grid object, the format is a Cell property, where each cell element is a character vector. It determines the format used to display numeric values in cells of a Grid object. The format string is a character vector of up to three parts, where each part is separated by a semicolon. If you supply just one part, it applies to all numbers. If you supply two parts, the first applies to positive numbers or zero, and the second to negative numbers. If you supply all three parts, the first applies to numbers greater than zero, the second to less than zero, and the third to zero.

Each part comprises a set of characters giving the format for the number. These comprise:

Character | Meaning
0 | Required digit. If the number has a digit in the position where the '0' appears in the format, then that digit is displayed, otherwise 0 is displayed. Thus, the positions of the leftmost '0' before the decimal point and the rightmost '0' after the decimal point in the format determine the range of digits that are always displayed.
# | Optional digit. If the number has a digit in the position where the '#' appears in the format, then that digit is displayed. Otherwise, nothing is displayed in that position.
. | Decimal point. The first '.' character in the format string determines the location of the decimal separator in the display. (The actual character used as a the decimal separator may depend on the locale set in the operating system).

,

Thousands separator. If the format string contains one or more ',' characters, the output will have thousand separators inserted between each group of three digits to the left of the decimal point. The placement and number of ',' characters in the format string does not affect the output, except to indicate that thousand separators are wanted. (The actual character used may depend on the locale set in the operating system.)

E+

Scientific notation. If any of the strings 'E+', 'E-', 'e+', or 'e-' are contained in the format string, the number is formatted using scientific notation. A group of up to four '0' characters can immediately follow the 'E+', 'E-', 'e+', or 'e-' to determine the minimum number of digits in the exponent. The 'E+' and 'e+' formats cause a plus sign to be output for positive exponents and a minus sign to be output for negative exponents. The 'E-' and 'e-' formats output a sign character only for negative exponents.

' " | Quotes. Characters enclosed in single or double quotes are output unchanged.

Setting this value automatically sets the cell type to Numeric.

Topic: APLX Help : System Classes : Properties : format

[ Previous | Next | Contents | Index ]