Manipulação do Excel pelo delphi

10/03/2006

0

Olá pessoal alguém tem experiencia com manipulação do excel através do delphi?

Tipo preencher células com dados de uma tabela, pegar os dados e colocar ao invés de linhas coloca-los em colunas?

Se alguém tiver alguma experiencia ou sugestão sobre material pra estudo, links úteis, artigos qualquer coisa mesmo...se puder me ajudar ficaria extremamente agradecido...

Até mais...


Gardel

Gardel

Responder

Post mais votado

10/03/2006

Você também pode conferir um artigo meu que foi publicado recentemente:

[url=https://www.devmedia.com.br/visualizacomponente.aspx?comp=1298&site=3]Exportar para Excel incluindo imagens[/url]

[]s


Adriano Santos

Adriano Santos
Responder

Mais Posts

10/03/2006

Ermindo

Gardel,

Tenta usar isso:



procedure TForm1.SpeedButton1Click(Sender: TObject);
var
Excel : Variant;
Linha:Integer;
begin
Excel := CreateOleObject(´Excel.Application´);
Excel.Visible :=True;
{Excel.Workbooks.Add;}
Excel.WorkBooks.Open(´\\SERVIDOR\Cotacao\Gerar.xls´);
Excel.WorkBooks[1].Sheets[1].Cells[2,7]:=Now;
Excel.WorkBooks[1].Sheets[1].Cells[3,2]:=DMCotacao.TBLiberaRemetente.Value;
Excel.WorkBooks[1].Sheets[1].Cells[3,5]:=DMCotacao.TBLiberaColeta.Value +
´-´ +DMCotacao.TBLiberaUF_Coleta.Value;
Excel.WorkBooks[1].Sheets[1].Cells[4,2]:=DMCotacao.TBLiberaDestinatario.Value;
Excel.WorkBooks[1].Sheets[1].Cells[4,5]:=DMCotacao.TBLiberaDestino.Value +
´-´ +DMCotacao.TBLiberaUF_Destino.Value;
Excel.WorkBooks[1].Sheets[1].Cells[5,2]:=DMCotacao.TBLiberaQuantidade.AsString;
Excel.WorkBooks[1].Sheets[1].Cells[5,5]:=DMCotacao.TBLiberaFreteEmpresa.AsString;
Excel.WorkBooks[1].Sheets[1].Cells[5,7]:=DMCotacao.TBLiberaContrato.AsString;
Excel.WorkBooks[1].Sheets[1].Cells[6,2]:=FormCTEmbarque.Edit2.Text;
Excel.WorkBooks[1].Sheets[1].Cells[6,5]:=FormCTEmbarque.Edit3.Text;
Excel.WorkBooks[1].Sheets[1].Cells[6,7]:=FormCTEmbarque.Edit4.Text;
Excel.WorkBooks[1].Sheets[1].Cells[7,2]:=DMCotacao.TBLiberaObservacao.Value;
DmCotacao.QCTEmbarque.Open;
Linha:=10;
While not DMCotacao.QCTEmbarque.Eof do
Begin
Excel.WorkBooks[1].Sheets[1].Cells[Linha,2]:=DMCotacao.QCTEmbarqueCTRC.Value;
Excel.WorkBooks[1].Sheets[1].Cells[Linha,3]:=DMCotacao.QCTEmbarqueNotaFiscal.Value;
Excel.WorkBooks[1].Sheets[1].Cells[Linha,4]:=DMCotacao.QCTEmbarquePeso.Value;
Excel.WorkBooks[1].Sheets[1].Cells[Linha,5]:=DMCotacao.QCTEmbarquePlaca.Value;
Excel.WorkBooks[1].Sheets[1].Cells[Linha,6]:=DMCotacao.QCTEmbarqueData.Value;
DmCotacao.QCTEmbarque.Next;
Linha:=Linha+1;
end;
Excel.WorkBooks[1].SaveAs(´\\SERVIDOR\Cotacao\Controle.xls´);
DMCotacao.TBCotacao.Refresh;
end;


Responder

11/03/2006

Gardel

Obrigado colegas...

Já me esclareceu bem as idéias :D

Até mais


Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar