OFiller demo
Create a template XLSX document with the name
ofiller-test.xlsx and add
the text
#NAME into some cell. Then run this code:
procedure TForm1.Btn1Click(Sender: TObject);
var
xOFiller: TCustomOFiller;
begin
xOFiller := TOFillerXLSX.Create;
try
OCopyFile(docDir+'ofiller-test.xlsx', docDir+'ofiller-test-out.xlsx', False);
xOFiller.LoadFromFile(docDir+'ofiller-test-out.xlsx');
xOFiller.ReplaceText('#NAME', 'Ondrej Pokorny');
xOFiller.Save;
finally
xOFiller.Free;
end;
end;
You can fill XLSX, DOCX, ODS and ODT templates. The usage is always the same.
Use these classes:
- for XLSX files: TOFillerXLSX
- for XLS files: TOFillerXLS
- for DOCX files: TOFillerDOCX
- for ODS files: TOFillerODS
- for ODT files: TOFillerODT