I'm using the following code to export a report to Excel in Lazarus:
procedure Tfrmconsultar.BitBtn2Click(Sender: TObject);
var
PLANILHA:variant;
LINHA,CONT:Integer;
begin
CONT:=QueryClientes.RecordCount;
ProgressBar1.Max:=CONT;
ProgressBar1.Position:=0;
QueryClientes.Filtered:=FALSE;
LINHA:=2;
//Cria a planilha e renomeei para Extrato Clientes
PLANILHA:=CreateOleObject('Excel.Application');
PLANILHA.caption:='Extrato Clientes';
PLANILHA.visible:=FALSE;
PLANILHA.workbooks.add(1);
PLANILHA.cells[1,1]:='Código';
PLANILHA.cells[1,2]:='Nome';
PLANILHA.cells[1,3]:='E-mail';
PLANILHA.cells[1,4]:='Nascimento';
PLANILHA.cells[1,5]:='Celular';
PLANILHA.cells[1,6]:='Cadastro';
QueryClientes.DisableControls;
try
while not QueryClientes.Eof do
begin
PLANILHA.cells[linha,1]:=QueryClientesid_cliente.Value;
PLANILHA.cells[linha,2]:=QueryClientesnome.Value;
PLANILHA.cells[linha,3]:=QueryClientesemail.Value;
PLANILHA.cells[linha,4]:=QueryClientesnascimento.Value;
PLANILHA.cells[linha,5]:=QueryClientescelular.Value;
PLANILHA.cells[linha,6]:=QueryClientesdata_cadastro.Value;
LINHA:=LINHA+1;
QueryClientesdata_cadastro.DataSet.Next;
ProgressBar1.Position:=ProgressBar1.Position+1;
end;
PLANILHA.columns.autofit;
PLANILHA.visible:=true;
finally
PLANILHA:=Unassigned;
end;
end;
When executing the code it exports to excel, however the fields that contain the information are with the whole text in Japanese: thus: 敒 慮 潴
Only the date fields that appear, how can I set an encoding to change this?