c# 水晶报表中处理TextObject
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);
}
}
转载于:https://www.cnblogs.com/lfzwenzhu/archive/2010/11/17/1879761.html
c# 水晶报表中处理TextObject相关推荐
- 在水晶报表中实现任意选择指定字段显示-模板及C#升级版
前文<在水晶报表中实现任意选择指定字段显示>中有朋友留言说是有无C#版本,最近有时间,重写了一下. 一是使用了VS2005 C#2.0 + Crystal Report 2008,另外就是 ...
- 水晶报表中如何创建自定义的纸张大小格式?
问题 水晶报表中使用一个自定义的纸张类型格式(使用预先定义的纸张格式显示或者打印一个报表)? 解决方法 要创建一个自定义的纸张格式,来完成你工作中所使用的特殊纸张.在你开始工作之前,你必须确认你的打印 ...
- 在水晶报表中动态显示任意格式的图片
在水晶报表中动态显示任意格式的图片 如何在水晶报表中动态显示任意格式的图片 前段时间,Accounting 项目内需要在水晶报表中动态显示任意格式的图片.但是,水晶报表只支持OleDb的 ...
- 利用数据集在水晶报表中显示图像
描述 该 C# .NET Windows 程序演示了如何创建数据集,并将图像添加到数据集,以及在运行时将数据集传递到子报表. 文件列表 - bin\Debug\Canada.jpg - bin\Deb ...
- 水晶报表中对某一栏位值进行处理_终于有人讲清楚了,BI和报表的差异!
IT系统自带报表功能,为什么还要额外采购BI? 报表和BI都能做数据分析,区别在哪里? 加班加点做了那么多表,为什么还不满足老板需求? 报表分析需要IT团队来开发,那BI呢? 这些应该是大家对商业智能 ...
- 利用数据集在水晶报表中显示图像的 .NET 程序教程
目录 描述 文件列表 步骤 Form1.cs VB.NET 版 描述 该 C# .NET Windows 程序演示了如何创建数据集,并将图像添加到数据集,以及在运行时将数据集传递到子报表. 文件列表 ...
- winform水晶报表中添加图片
文章目录 前言 一.VS中找不到ReportView 二.使用步骤 1.直接拉取控件到窗体 编辑 2.添加参数 总结 前言 应用场景:在做一个巡检机器人项目时,对于巡检结果,需要在Winform端显 ...
- 水晶报表中让行高自适应高度(即根据内容的来适应高度)
1.在水晶报表打印中,有些内容可能占两行.三行.四行内容,但有些内容仅占一行内容,如果固定行高,会造成纸张的很大的浪费,如下图所示 2.如上图所示,零件型号.名称.规格三列超出一行内容,怎么让内容自适 ...
- 在水晶报表中使用Code128条形码
1.将code128条码字体拷贝到C:\Windows\fonts下 下载地址是 http://download.csdn.net/detail/easyboot/9452777 2 .在水晶报表里的 ...
最新文章
- [分享]五种提高 SQL 性能的方法
- 皮一皮:现在当爹妈的不容易...
- 压力测试与提升服务器能力的几个方法
- iOS - 修改 UITextField 的 clearButtton 样式
- 支付二维码php能实现吗_(实用篇)微信支付扫码支付php版
- php oracle视图,Oracle v$database视图分析
- JavaScript学习笔记:数组reduce()和reduceRight()方法
- C++(Leetcode):两数之和
- 推荐2本书 《浪潮之巅》 和 《数学之美》
- 谈debug版本可以正常运行,而在release下运行出错之原因及避免类似情况发生
- 使用PMOS管构建电源延时供电电路
- 图片//////////
- 人体常用穴位按摩保健方法(动画图解)
- Windows 安装 MySQL 8 zip版安装,及Windows MySQL多实例
- 中国剩余定理 (孙子定理) 的证明和代码
- Python绘制图片一
- 【stm32】delay详解
- 【效率工具】史上最好用的SSH一键登录脚本,超强更新!
- 坑爹的APAR IT08059.
- 研读Rust圣经解析——Rust learn-15(unsafe Rust )
热门文章
- Why Spring Boot
- 3.浏览器输入www.baidu.com到显示主页的全过程
- geek软件_社团秀@UNC新媒体协会@管理会计研学社@Geek社团
- 某厂家精密空调精品培训资料
- “春色满园”!谷歌新数据中心有望实现100%可再生能源
- 电池报废征兆,三招辨别该不该换新
- AI:2020年6月22日北京智源大会演讲分享之09:50-10:40 Anil教授《Pattern Recognition: Statistics to Pattern Recognition》
- Dataset之HiggsBoson:Higgs Boson(Kaggle竞赛)数据集的简介、下载、案例应用之详细攻略
- ML之xgboost:利用xgboost算法(sklearn+3Split+调参曲线)训练mushroom蘑菇数据集(22+1,6513+1611)来预测蘑菇是否毒性(二分类预测)
- Google提出的新型激活函数:Swish