这个问题在我的项目里也存在,直接使用CrystalReportView来显示就有这个问题,后来我把水晶报表导出为pdf格式,再用ie打开该pdf文件就正常了,而且还解决了打印问题,水晶报表的打印方法是用于服务器的,在客户端不行。下面函数实现了导出pdf或word文件并在ie中显示,其中CryReport是我做的水晶报表文件名,string OptionStr是操作字符,可选"Portable Document (PDF)"和"MS Word (DOC)"调用方式为ExportReport(水晶报表实例,操作字符)private void ExportReport(CryReport Report,string OptionStr)
{

string ExportPath;
ExportPath = Request.PhysicalApplicationPath + "Exported\\";
if (Directory.Exists(ExportPath) == false) Directory.CreateDirectory(Request.PhysicalApplicationPath + "Exported\\");    
ReportDocument crReportDocument = (ReportDocument)Report;
DiskFileDestinationOptions crDiskFileDestinationOptions = new DiskFileDestinationOptions();
ExportOptions crExportOptions = crReportDocument.ExportOptions; switch(OptionStr)
{
case "Portable Document (PDF)":
crDiskFileDestinationOptions.DiskFileName = ExportPath + "PortableDoc.pdf";
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
break;
case "MS Word (DOC)":
crDiskFileDestinationOptions.DiskFileName = ExportPath + "Word.doc";
crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
crExportOptions.ExportFormatType = ExportFormatType.WordForWindows;
crExportOptions.DestinationOptions = crDiskFileDestinationOptions;
break;
}

try
{
// Export the report
crReportDocument.Export();
crReportDocument.Close();
Response.ClearContent();
Response.ClearHeaders();
switch(OptionStr)
{
case "Portable Document (PDF)":
Response.ContentType="application/pdf";
Response.WriteFile(ExportPath + "PortableDoc.pdf");
break;
case "MS Word (DOC)": Response.ContentType="application/msword";
Response.WriteFile(ExportPath + "Word.doc");
break;
}  Response.Flush();
Response.Close();
}
catch (Exception err)
{
Response.Write("<BR>");
Response.Write(err.Message.ToString());
}
}

解决方案 »

  1.   


    文本对象->属性->格式化->公用->水平对齐
      

  2.   

    ckvip(暗黑骑士) ,谢谢。我知道导出为pdf格式可以解决,但是我这个项目需要在web里显示。而且在web里显示pdf或者word都不太合适。不过还是谢谢你的代码,以后一定用的着^-^。
    The123(在我地盤這 伱就得聽我的) ,我要的不是水平对齐,我需要的是纵向的对齐方式。不过我现在在水晶报表里还没找到相应的功能:(好几天没来,谢谢大家的回复。看来这个问题还是没有很好的解决办法,这个贴子先结了。