日期:2014-05-19  浏览次数:20461 次

100分水晶报表打印的解决方案。先到先得分.顺便散散分.
没有用过水晶报表,但是最近要用.
解决问题:
1:弹出窗口被IE拦截的问题。
2:自定义工具栏,需要和原报表功能差不多。
3:导出EXCEL只有一个页眉。而后面的页就没有页眉。

手里没这方面的资料,只能请大家帮忙了.

PS:需要实例
有相关实例或文档麻烦发到这里.
Email:   Grimfish@126.com

------解决方案--------------------
\沙发
------解决方案--------------------
up
------解决方案--------------------
up
------解决方案--------------------
接分再看!
------解决方案--------------------
up
------解决方案--------------------
接分再说
------解决方案--------------------

------解决方案--------------------
http://www.cnblogs.com/zhangyd1080/archive/2006/11/15/561770.html
------解决方案--------------------
1,不要用脚本语言,要用也要写在后台

3,区分报表页眉和页眉
------解决方案--------------------
方案一:
先添加这两个引用
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
以下选定格式打印
private void btnExport_Click(object sender, System.EventArgs e)
{
CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions();
ReportDoc.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
switch (ddlFormat.SelectedItem.Text)
{
case "Rich Text (RTF) ":
  ReportDoc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.RichText;//
  DiskOpts.DiskFileName = "c:\\Output.rtf ";//
break;
case "Portable Document (PDF) ":
  ReportDoc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;//
  DiskOpts.DiskFileName = "c:\\Output.pdf ";//
break;
case "MS Word (DOC) ":
  ReportDoc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.WordForWindows;//
  DiskOpts.DiskFileName = "c:\\Output.doc ";//
break;
case "MS Excel (XLS) ":
  ReportDoc.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel;//
  DiskOpts.DiskFileName = "c:\\Output.xls ";//
break;
default:
break;
}
ReportDoc.ExportOptions.DestinationOptions = DiskOpts;
  ReportDoc.Export();
}
ReportDoc是一水晶报表的实例化对象
方案二:
以下是一个以流模式打印datagrid的例子,水晶报表亦相同
private void btnGet_Click(object sender, System.EventArgs e)
{
Response.ContentType = "application/vnd.ms-excel ";
Response.Charset = " ";
this.EnableViewState = false;
System.IO.StringWriter sw = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(sw);
int nCur = this.dgOrder.CurrentPageIndex;
int nSize = dgOrder.PageSize;

dgOrder.AllowPaging = false;

string Content = this.txtContent.Text.Trim();
if( this.ddlQuery.SelectedIndex == 0)
{
BindtoDG( Content,this.UserBillProc,this.OrderID );
}