程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> c# 水晶報表中處理TextObject

c# 水晶報表中處理TextObject

編輯:C#入門知識

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

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved