[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Formatting cells in a spreadsheet
Excellent! Works like a charm. Thanks David.
-----Original Message-----
From: David Wright [mailto:dwright@xxxxxxxxxxxxxxxxxx]
Sent: Tuesday, May 12, 2009 2:28 PM
To: HTTPAPI and FTPAPI Projects
Subject: RE: Formatting cells in a spreadsheet
Assuming it works like the Custom format in Excel, try this:
TempStr = new_String('##0.000 \%');
The backslash is needed to make the % be treated as a literal. Without
a backslash the value would be displayed as:
8552.000 %
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Karl Woods
Sent: Tuesday, May 12, 2009 1:19 PM
To: HTTPAPI and FTPAPI Projects
Subject: Formatting cells in a spreadsheet
I'm creating excel spreadsheets using Scott's HSSF examples and have a
question. A cell is set up to display a percentage and I use the
following code to define the cell:
Numeric3 = HSSFWorkbook_createCellStyle(book);
TempStr = new_String('##0.000');
NumFmt = HSSFDataFormat_getFormat(DataFmt: TempStr);
HSSFFont_setBoldweight(ChFont: BOLDWEIGHT_BOLD);
HSSFCellStyle_setFont(Numeric3: ChFont);
HSSFCellStyle_setDataFormat(Numeric3: NumFmt);
HSSFCellStyle_setAlignment(Numeric3: ALIGN_RIGHT);
When outputting data to the field it looks like this: 85.52
Management has asked if I can add the percent sign (%) at the end of the
field, like this: 85.52%
I've been unsuccessful in getting the percent sign to show up. Any
assistance would be appreciated.
Karl B. Woods
Sr. Programmer/Analyst
Professional Services
1960 S. Milestone Dr., Ste B
Salt Lake City, UT 84104
( Tel: (801) 433-9426 (office)
( Fax: (801) 478-2775
* E-mail: karl.woods@xxxxxxxxxxxxxx <mailto:karl.woods@xxxxxxxxxxxxxx>
LiveSTRONG
....... __o Same Road
....... \<, Same Rules
.... ( )/ ( ) Same Rights
This e-mail contains proprietary information and may be confidential. If
you are not the intended recipient of this e-mail, you are hereby
notified that any dissemination, distribution or copying of this message
is strictly prohibited. If you received this message in error, please
delete it immediately.
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------