0
I’m exporting a clientdataset for excel with the Clientdatasettoexcelfile function, but one of the information is CPF/CNPJ ex: 00112312312, that is, it contains zeros(0) at the beginning of the string. When exporting excel ends up removing these characters because the cell is of the GENERAL type as default.
Here I feed the cell:
Excel.WorkBooks[1].Sheets[iSheet].Cells[eline,(vCol+1)] := pQr.Fields[i].AsString;
I tried to use the following instruction:
Excel.WorkBooks[1].Sheets[iSheet].Cells[eline,(vCol+1)].NumberFormat := '@';
In excel works, but in my case replaced the values by "64" and logically worked nothing.
I use Delphi XE...
Any hint?
Buenas Ricardo, actually in my example I tried to change the order, but it did not work, always it replaces the value of the cell by 64, I believe it is the ascii value of @... you use Delphi XE also?
– henriquew
Falaaaa..: ).. Cara testei com DELPHI 7 .. Na Maquina Virtual que tenho o Delphi CE instalado, não tem ofice.. :(
– Ricardo M.Souza
I’ve had this problem. Excel displays 64, but if you specify another format, the content is correct. I usually include an apostrophe starting the content to stay as text.
– Ricardo Alves Carvalho