NewPHExcel
A função NewPHExcel cria e retorna uma nova instância de um objeto que permite manipular planilhas do Excel.
Parâmetros
Nenhum
Sintaxe
Function NewPHExcel: TPHExcel;
Exemplos
var Excel: TPHExcel; begin // Criando uma nova instância do Excel Excel := NewPHExcel;
try
// Criando uma nova planilha
Excel.NewSheet('Relatório');
// Inserindo valores nas células
Excel.SetCellValue(1, 1, 'Nome');
Excel.SetCellValue(1, 2, 'Idade');
Excel.SetCellValue(2, 1, 'João');
Excel.SetCellValue(2, 2, 30);
// Salvando o arquivo
Excel.SaveToFile('C:\Relatorio.xlsx');
ShowMessage('Arquivo Excel gerado com sucesso!');
finally
// Liberando o objeto após o uso
Excel.Free;
end;
end.