Jump to content
Fórum Script Brasil
  • 0

(Resolvido) Erro ao exportar arquivos para o Excel


danielrgoes

Question

Bom dia Pessoal

Eu fiz um codigo para exportar dados para o Excel

ExcelApplication1 := TExcelApplication.Create(nil);

ExcelApplication1.Workbooks.Add(EmptyParam,0);

ExcelApplication1.Visible[0] := True;

Planilha := ExcelApplication1.Workbooks [1].Worksheets[1];

Planilha.Cells[1,1].Value := 'RELATÓRIO DE COMPUTADORES';

Planilha.Cells[1,1].Select; //seleciona a celula

Planilha.Cells[1,1].Font.Bold := True; //coloca em negrito

Planilha.Cells[1,1].Borders.LineStyle := 1;

Planilha.Cells[1,1].Borders.Color := clBlack;

Planilha.Cells[1,1].Interior.Color := clYellow; // muda a cor d fundo da linha

Planilha.range['A1:N1'].Mergecells := True; //mescla as celulas

Planilha.Cells[1,1].HorizontalAlignment := xlcenter;

ExcelApplication1.columns.AutoFit;

Planilha.SaveAs(SaveDialog1.FileName);

ExcelApplication1.Quit;

ExcelApplication1.Free;//libera memoria

Ate ai sem novidades funcionou

Porem o excel precisa estar fechado se estiver aberto da Erro

alguém sabe como contornar ?

Pessoal revolvi

apaguei a linha :

Planilha.Cells[1,1].Select; //seleciona a celula

Obrigado

Edited by danielrgoes
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...