Format::setTextRotation (Previous) (Next) Format::setStrikeOut

View this page in Last updated: Sun, 01 Jul 2007
English | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Plain HTML

Format::setNumFormat

Format::setNumFormat -- Sets the numeric format.

Descripción

Sets the numeric format. It can be date, time, currency, etc... The following table lists possible values for $num_format and the corresponding types that a numeric format expects as arguments.

Tabla 39-1. Numeric formats and types

0DecimalThe amount of zeros specifies the amount of digits that will be shown
0.00DecimalThe amount of zeros after the decimal dot specifies the amount of decimal digits that will be shown
#.##DecimalThe amount of sharp signs after the decimal dot specifies the maximum amount of decimal digits that will be shown
0%PercentThe amount of zeros specifies the amount of digits that will be shown.
0.000%PercentThe amount of zeros after the decimal dot specifies the amount of decimal digits that will be shown.
$#.#;[Red]($#.#)CurrencyZeros and sharp signs have the same meaning as in other formats.
??/??FractionThe amount of question signs in the denominator determines its precision (maximum amount of digits in the denominator).
# ??/??FractionA fraction with an integer part. Zeros and sharp signs are used for defining the integer part, and they have the same meaning as in other formats.
0.00E+#ScientificIn scientific notation base and exponent are formated according to the same rules applied to decimals. For scientific notation zeros and sharp signs appear to be equivalent.
D-MMM-YYDateA date represented in the given notation. Month can be a one or two digits month, or a three letter month. Year can have 2 or 4 digits. The argument to be formated as a date is considered to be the number of days since December 30 1899 (Excel's day zero). For dates preceding day zero, negative numbers can be used.
D/M/YYYY h:mm:ssDate/TimeA date represented in the given notation. The argument to be formated as a date is considered to be the number of days since Excel's day zero.
h:mm:ss AM/PMTimeA time represented in the given notation. Be careful, the argument to be formated as a time has to be given in days. For example an argument of 0.5 would be presented as '12:00:00 PM'.

The information here presented comes from OpenOffice.org's Documentation of the Microsoft Excel File Format (http://sc.openoffice.org/excelfileformat.pdf).

Parámetro

  • string $num_format - The numeric format.

Nota

Esta función no puede ser llamada estáticamente.

Format::setTextRotation (Previous) (Next) Format::setStrikeOut

Download Documentation Last updated: Sun, 01 Jul 2007
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
Note by: zetflo@gmail
Hi,

perhaps, this library support only the symbol $.

I've the same problem with symbol ¤
Note by: oldhand@fusemail.com
Noticed some strange behaviour with this when setting more complicated number formats e.g. currency

I was trying to set currency to display for UK pounds as follows £159,000

The format for this is £#,##0;-£#,##0

When setting this the format appeared to get corrupted by character encoding as my PHP file was UTF8 format.

If I forced the formatting to ISO-8859-1 before inserting this everything worked - see example below:

$myNumFormat = '£#,##0;-£#,##0';
$iso88591Format = iconv("utf-8","iso-8859-1",$myNumFormat);
$cFormat =& $xls->addFormat();
$cFormat->setNumFormat($iso88591Format);

Hope that helps saves someone else a few hours!