Delphi将html文件保存为Excel,或者word格式

  • var

  • FileName :String;

  • fs :TMemoryStream;

  • Filepath : String;
    begin
    Filepath :=‘C:\ListView.htm’;
    try
    fs := TMemoryStream.Create;
    //FileName :=ExtractFileName(Filepath);

    try
    fs.LoadFromFile(Filepath );
    savedialog1.Filter:=‘.xlsx|.xlsx’;//word格式(docx)
    if (savedialog1.Execute) then fs.SaveToFile(savedialog1.filename);
    end;
    except on e:Exception do
    ShowMessage(e.Message);
    end;
    finnaly
    fs.Free;
    end;

你可能感兴趣的:(Delphi)