1

Topic: Problem with the job of a string cell format

The kind.
Delphi XE2, Excel 2007.
Colleagues I fight the second day and anything I can not understand. The task: to export the data and that an ex-fur-tree their automatic machine to dates did not transform decided to put a format of cells at export to the text. I write so:

ExcelApp: = CreateOleObject (' Excel. Application ');
ExcelApp. WorkBooks. Add;
ExcelApp. Workbooks [1].Sheets. Item [1].Cells [1,1].NumberFormat: = ' ';//here so
ExcelApp. Workbooks [1].Sheets. Item [1].Cells [1,1].NumberFormat: = #64;// so one result

The cell format thus does not change, as a format the cell has a prime number 64 and the format type turns out: all formats.
Thus if to try to make a number format, all is normal:

ExcelApp. Workbooks [1].Sheets. Item [1].Cells [1,1].NumberFormat: = ' 0,00 ';//all is normal, a number format

I can not think in what business why as a format the code of a dog, namely number "64" is transferred simply? Where to dig, how still to check? If to fulfill the code through macroes most  all is normal - a cell format changes on the text.

2

Re: Problem with the job of a string cell format

Happens after all, only wrote also all dared by itself.
Here so works:

s1: = ' ';
ExcelApp. Workbooks [1].Sheets. Item [1].Cells [1,1].NumberFormat: = s1;

Came to it after a row of requests to , but a pancake I do not understand why?? Upon anything did not change at all.

3

Re: Problem with the job of a string cell format

If bring number and want, that excel perceived it as a text cell - before digit put the apostrophe character - excel does not show an apostrophe -  that the come number is , for example:

i: integer;
...
i: = 5
ExcelApp. Workbooks [1].Sheets. Item [1].Cells [1,1].Value2: = ' "' + i;
...