比较麻烦.
如果一定要通过asp.net打印,据我所知只能按你要求的格式做成水晶报表,转为pdf文件,由用户下载后再打印.

解决方案 »

  1.   

    刚才短消息发不出,只好贴在这里了:设计水晶报表不用我说了吧?看msdn:
    ms-help://MS.VSCC/MS.MSDNVS.2052/crystlmn/html/crconcrystalreports.htm//下面的代码可以将报表生成PDF文件:
    报表名称 myrpt=new 报表名称();
    myrpt.ExportOptions.ExportDestinationType=CrystalDecisions.Shared.ExportDestinationType.DiskFile;
    myrpt.ExportOptions.ExportFormatType=CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
    CrystalDecisions.Shared.DiskFileDestinationOptions opt=new CrystalDecisions.Shared.DiskFileDestinationOptions();
    opt.DiskFileName=@"PDF文件名";
    myrpt.ExportOptions.DestinationOptions =opt;
    myrpt.Export();//下载:
    string destFileName=@"PDF文件名";
    FileInfo fi = new FileInfo(destFileName);
    Response.Clear();
    Response.ClearHeaders();
    Response.Buffer = false;
    Response.AppendHeader("Content-Disposition","attachment;filename=" + Server.UrlEncode(Path.GetFileName(destFileName)));
    Response.AppendHeader("Content-Length",fi.Length.ToString());
    Response.WriteFile(destFileName);
    Response.Flush();
    Response.End();