首页 ┆网站地图 ┆游戏资讯 ┆天龙八部 ┆资源下载 ┆淘宝网购物 ┆淘宝数码产品 ┆淘宝数码相机 
设为首页
加入收藏
联系我们
高级搜索
您当前的位置: 主页 > NET专区 > 报表 > c#怎么在水晶报表中处理TextObject?
c#怎么在水晶报表中处理TextObject?
来源: 发布时间:2010-11-19 浏览:人次  字体:[  
c#怎么在水晶报表中处理TextObject?具体实现代码如下:

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
 
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.DataDefModel;
 
 
public partial class _Default : System.Web.UI.Page
{
    protected ReportDocument boReportDocument;
 
 
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.IsPostBack)
        {
            ConfigureCrystalReports();
        }
 
        CrystalReportViewer1.ReportSource = Session["Report"];
 
    }
 
    protected void ConfigureCrystalReports()
    {
        ISCDReportClientDocument boReportClientDocument;       
        CrystalDecisions.ReportAppServer.Controllers.ReportObjectController boReportObjectController;
        CrystalDecisions.ReportAppServer.ReportDefModel.TextObject boOldTextObject, boNewTextObject;
        CrystalDecisions.ReportAppServer.ReportDefModel.Paragraph boParagraph;
        CrystalDecisions.ReportAppServer.ReportDefModel.ParagraphFieldElement boParagraphFieldElement;
        CrystalDecisions.ReportAppServer.ReportDefModel.ParagraphTextElement boParagraphTextElement;
       
        boReportDocument = new ReportDocument();
        boReportDocument.Load(Server.MapPath("CrystalReport.rpt"));
 
        boReportClientDocument = boReportDocument.ReportClientDocument;       
        boReportObjectController = boReportClientDocument.ReportDefController.ReportObjectController;
              
 
        // Get a handle on the ReportObjectController so we can manipulate the TextObject       
        foreach (CrystalDecisions.ReportAppServer.ReportDefModel.ReportObject boReportObject in boReportObjectController.GetAllReportObjects())
        {
            if (boReportObject.Kind == CrystalDecisions.ReportAppServer.ReportDefModel.CrReportObjectKindEnum.crReportObjectKindText)
            {
                boOldTextObject = (CrystalDecisions.ReportAppServer.ReportDefModel.TextObject)boReportObject;
                boNewTextObject = (CrystalDecisions.ReportAppServer.ReportDefModel.TextObject)boOldTextObject.Clone(true);
               
                // Clear out all paragraphs from the current text object
 
                boNewTextObject.Paragraphs.RemoveAll();
 
                // Create a new Paragraph to add to our TextObject
                boParagraph = new CrystalDecisions.ReportAppServer.ReportDefModel.Paragraph();
 
                // Create a new ParagraphTextElement to be added to our paragraph
               
                boParagraphTextElement = new CrystalDecisions.ReportAppServer.ReportDefModel.ParagraphTextElement();               
                boParagraphTextElement.Text = "The value of my parameter is: ";
                boParagraph.ParagraphElements.Add(boParagraphTextElement);               
 
                // Create a new ParagraphFieldElement (our parameter field) to be added to our paragraph               
                boParagraphFieldElement = new CrystalDecisions.ReportAppServer.ReportDefModel.ParagraphFieldElement();
                boParagraphFieldElement.Kind = CrystalDecisions.ReportAppServer.ReportDefModel.CrParagraphElementKindEnum.crParagraphElementKindField;
                boParagraphFieldElement.DataSource = "{?Currency}";               
 
                boParagraph.ParagraphElements.Add(boParagraphFieldElement);
               
                boNewTextObject.Paragraphs.Add(boParagraph);
               
                boReportObjectController.Modify(boOldTextObject, boNewTextObject);
 
                break;
            }
        }
 
        Session.Add("Report", boReportDocument);
    }
}

↓下一篇:没有了
 
相 关 文 章 发布商链接
·水晶报表一页如何分上下两部分列印的...
·图解水晶报表交叉表缺口补齐方法
·图解交叉表的百分比功能实现
·图解水晶报表交叉表及数据过滤基础...
·水晶报表怎样实现导出一个Excel表格...
·webchart和teechart控件导出图片的方...
·TeeChart控件如何使用中文的方法介绍
·vs2003和水晶报表9的使用说明
·.net下对水晶报表的多表显示数据
·Win2003打印水晶报表没有权限与报表...
 §最新评论:(评论内容只代表网友观点,与本站立场无关!)淘宝店铺一条街淘宝运动鞋淘宝网热门男装
网名:  验证码:  【所有评论】【↑返回顶部
评 分:12345
评论内容:(不能超过500字,请自觉遵守互联网相关政策法规。[按 Ctrl+Enter 可直接提交]
注意:请勿在本站发布政治话题、色情及违反法律的内容。
IT知道网 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。
推 荐 文 章
·图解水晶报表交叉表缺口补齐...
·图解水晶报表交叉表及数据过...
·RDLC报表部署遇到的问题及其...
·初学RDLC报表遇到问题的一些...
·ASP.net集成水晶报表的操作
·ActiveRecord中实体类问题解...
·ActiveReport出现"No Report ...
·ActiveReport在WebForm下的显
·ActiveReport通过代码进行动...
·ActiveReport创建报表文件及...
·Active Report使用心得之配置...
推 荐 主 题
java专题.net开发php学习
数据库windows7Word技巧
天龙八部QQ技巧IT职场
javascriptPhotoShop 淘宝购物
图 文 推 荐
Active Report使用心得之配置iis及web.config文件Active Report使用心得之配置iis及web.config文件
水晶报表一页如何分上下两部分列印的问题水晶报表一页如何分上下两部分列印的问题
ActiveReport在WebForm下的显示类型及数据的导出ActiveReport在WebForm下的显示类型及数据的导出
热 门 文 章
·初学RDLC报表遇到问题的一些...
·水晶报表怎样实现导出一个Exc...
·TeeChart控件如何使用中文的...
·Active Report使用心得之配置...
·RDLC报表部署遇到的问题及其...
·ASP.net集成水晶报表的操作
·.net下对水晶报表的多表显示...
·用友华表Cell控件实现数据xml...
·ActiveReport在WebForm下的显...
·vs2003和水晶报表9的使用说明
·ActiveReport创建报表文件及...
·ActiveReport通过代码进行动...
热 门 关 键 字
 网站首页 - 关于本站 - 加入收藏 - 网站地图 - 淘宝购物 - 在线留言 - 广告服务 - 返回顶部
Copyright © 2007 IT知道网.[冀ICP备07026896号]. All Rights Reserved .