当前位置:编程学习 > C#/ASP.NET >>

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
 
               &nbs

补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,