How to Format a Cell as pure Text

Questions and answers on how to use Axolot Data Delphi components.

How to Format a Cell as pure Text

Postby MW » Thu Apr 29, 2004 1:59 pm

Hi,

i have problem to format a Cell as pure Text.
To format as date/datetime, currency, integer etc isn't a Problem.
This is possible with the NumberFormat property.

But what is to do, if i want to format the cell as pure Text, not as standard ?

Has sombody an idea ?
MW
 
Posts: 3
Joined: Fri Apr 02, 2004 6:34 am

Postby larsa » Fri Apr 30, 2004 8:12 am

Hello

I'm not really sure on what you mean. If you want text, just add a cell value without any formattin, FormatIndex := -1.


Lars Arvidsson
larsa
Site Admin
 
Posts: 690
Joined: Mon Jun 27, 2005 9:30 pm

Postby Guest » Fri Sep 15, 2006 1:55 pm

Hi,

I have the same problem than MW. I add a cell with a value like '3165140022018' as textvalue to the sheet (it have to be a textvalue and not a numbervalue).

For example:
XLS.Sheet[0].AsWideString[1,1] := '3165140022018';

In the Excelsheet the value is represented accurately. But when I change the value in the Excelsheet in '3165140022019' the represented value will changed in '316514E+12'.
The reason for this is the default (standard) cell format. The '...E+...'-value will not apear with the cell format "text".

Is it possible to set the cell format to "text"?
Guest
 
Posts: 306
Joined: Tue Aug 16, 2005 6:08 pm

Postby KenWhite » Fri Sep 15, 2006 8:15 pm

Sure you can:

Code: Select all
XLS.Sheets[0].Cell[Col, Row].NumberFormat := '@';


Ken
Ken
KenWhite
 
Posts: 23
Joined: Mon Jan 03, 2005 8:23 pm

Postby Guest » Tue Sep 19, 2006 2:48 pm

now it works! Thanks a lot to KenWhite!
Guest
 
Posts: 306
Joined: Tue Aug 16, 2005 6:08 pm

Re: How to Format a Cell as pure Text

Postby grchristin » Sat May 29, 2010 4:45 am

Anyone have ideas on how to fix this? I have strings with leading spaces and I want them to stay there. The spaces appear to be there after XLSDbRead reads in the data but after writing it out and opening the spreadsheet the leading spaces are all gone.

FYI - this only happens when exporting to Excel2007. Works fine in with Excel97!

Thx in advance!
grchristin
 
Posts: 2
Joined: Sat May 29, 2010 3:53 am


Return to Help

Who is online

Users browsing this forum: No registered users and 2 guests