Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.89 KB | None | 0 0
  1. procedure TCreateRecord.SaveFileClick(Sender: TObject);
  2. type
  3.    Product = record
  4.       NameOfProduct, SortOfProduct , PriceOfProduct, Date: string[255];
  5. end;
  6. var
  7.    FileF: file of Product;
  8.    FileName: string;
  9.    OneProduct: Product;
  10.    i, j: Integer;
  11. begin
  12.    if SaveFileDialog.Execute then
  13.    begin
  14.       FileName := SaveFileDialog.FileName;
  15.       AssignFile(FileF, SaveFileDialog.FileName);
  16.       Rewrite(FileF);
  17.       with InputProduct do
  18.       begin
  19.          for i := 1 to RowCount do
  20.          begin
  21.             OneProduct.NameOfProduct := Cells[0, i];
  22.             OneProduct.SortOfProduct := Cells[1, i];
  23.             OneProduct.PriceOfProduct := Cells[2, i];
  24.             OneProduct.Date := Cells[3, i];
  25.             Write(FileF, OneProduct);
  26.          end;
  27.       end;
  28.       CloseFile(FileF);
  29.       ShowMessage('Данные успешно сохранены.');
  30.    end;
  31. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement