fastreport.net cdoe 自己的代码
//初始
Report report1 = new Report();
report1.Clear();
string ReportFileName = GetReportFileName(Rep);
//report1.Load(Environment.CurrentDirectory + "\\Report\\" + ReportFileName);
report1.Load(Environment.CurrentDirectory + "\\" + ReportFileName);
report1.RegisterData(ds);
//report1.RegisterData(dtItem, "item");//report1.RegisterData(ds.Tables[1], "Detail");
report1.GetDataSource("Detail").Enabled = true;
report1.GetDataSource("Master").Enabled = true;
report1.GetDataSource("Material").Enabled = true;
report1.GetDataSource("SUM").Enabled = true; DataBand dataBand1 = report1.FindObject("DataItem") as DataBand;
if (dataBand1 == null)
{
Msg.ShowError("数据区对象不存在,检查(DataItem)是否存在!");
return;
} PageHeaderBand PageHeader1 = report1.FindObject("PageHeader1") as PageHeaderBand;
if (PageHeader1 == null)
{
Msg.ShowError("页眉对象不存在,检查(PageHeader1)是否存在!");
return;
}
dataBand1.DataSource = report1.GetDataSource("Detail"); ////列标题位置参考对象
TextObject TxtObjRow = report1.FindObject("TextData") as TextObject;
if (TxtObjRow == null)
{
Msg.ShowError("参照对象不存在,检查(TxtObjRow)是否存在!");
return;
}
float iLeft = TxtObjRow.Left;
float iTop = TxtObjRow.Top;
float iWidth = TxtObjRow.Width;
float iHeight = TxtObjRow.Height; //列位置参考对象
TextObject TextHeadRow = report1.FindObject("TextHead") as TextObject;
if (TextHeadRow == null)
{
Msg.ShowError("参照对象不存在,检查(TextHead)是否存在!");
return;
}
float iLeft2 = TextHeadRow.Left;
float iTop2 = TextHeadRow.Top;
float iWidth2 = TextHeadRow.Width;
float iHeight2 = TextHeadRow.Height; DataSourceBase frxSource = report1.GetDataSource("Detail");
float AutoWith = 0;
if (AtuoSize == true)
{
AutoWith = (float)198 / (frxSource.Columns.Count -9);
}
else
{
AutoWith = 10;
} //对数据区的列自动生成,加载到报表中
int k = 0;
for (int i = 0; i < frxSource.Columns.Count; i = i + 1)
{
//重新设置数据源列别名,由于传入别名重复。默认情况,dataTable列是caption 自动对应的fastreport数据源列的别名
frxSource.Columns[i].Alias = frxSource.Columns[i].Name;
string col = frxSource.Columns[i].Name;
string colCaption = col.Replace("_1", "");
if (col == "ID" || col == "MaterialID" || col == "MaterialCode" || col == "MaterialName" ||
col == "Grade" || col == "LR" || col == "LenType" || col == "Sort" || col == "Com")
{
continue;
}
//if (col == "Row") continue; string sName = "[" + frxSource.Alias + "." + col + "]";
//数据区设置
TextObject txtObject = new TextObject();
txtObject.Name = col;
txtObject.Border.Lines = BorderLines.All;
txtObject.HorzAlign = HorzAlign.Center;
txtObject.VertAlign = VertAlign.Center;
txtObject.Font = new Font("宋体", 9.0f);
txtObject.EvenStyle = "Style1";
//txtObject.CreateUniqueName();
txtObject.Bounds = new RectangleF(k * Units.Millimeters * AutoWith, 0, Units.Millimeters * AutoWith, iHeight);
txtObject.Text = sName;
txtObject.HideZeros = true;//当为0,设置空
//设置打印内容格式
if (col == "Sph" || col == "row")
{ }
else
{
NumberFormat fn = new NumberFormat();
fn.UseLocale = false;
fn.DecimalDigits = 1;
fn.DecimalSeparator ="null" ;
txtObject.Format = fn;
}
dataBand1.Objects.Add(txtObject); //Head列区设置
TextObject txtObject1 = new TextObject();
txtObject1.Name = "txt" + col;
//txtObject1.CreateUniqueName();
txtObject1.Border.Lines = BorderLines.All;
txtObject1.HorzAlign = HorzAlign.Center;
txtObject1.VertAlign = VertAlign.Center;
txtObject1.Font = new Font("宋体", 9.0f);
txtObject1.Bounds = new RectangleF((k) * Units.Millimeters * AutoWith, iTop2, Units.Millimeters * AutoWith, iHeight2);
txtObject1.Text = colCaption;
if (col == "Sph" || col == "row")
{
txtObject1.Text = "球\\柱"; }
PageHeader1.Objects.Add(txtObject1);
k++; }
fastreport.net cdoe 自己的代码的更多相关文章
- Winform中使用FastReport的PictureObject时通过代码设置图片源并使Image图片旋转90度
场景 FastReport安装包下载.安装.去除使用限制以及工具箱中添加控件: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10 ...
- FastReport.Net在Rozor中的应用
Webconfig中配置 IIS6.0 <system.web> <httpHandlers> 下增加 <httpHandlers> <add path=&q ...
- fastreport代码转
2016-07-08 //打印主从表数据 string file = Application.StartupPath @"\MasterDetail.frx"; rptMaster ...
- 使用fastreport以代码方式创建报表
Report report = new Report();// register the "Products" tablereport.RegisterData(dataSet1. ...
- Winform中使用FastReport的DesignReport时怎样给通过代码Table添加数据
场景 FastReport安装包下载.安装.去除使用限制以及工具箱中添加控件: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/10 ...
- FastReport代码计算高度
Dim iHeight As Double Dim columnData_form As DataSourceBase iHeight=Page1.TopMarg ...
- 使用FastReport打印二维码
简单介绍一下该功能所在的项目背景:C#语言编写的WPF客户端应用程序,在“结账”模块中,打印出的收款小票上需要显示一个二维码,服务生拿着小票去找顾客,顾客可以选择现金.银行卡等普通支付方式,也可以直接 ...
- FastReport.Net 常用功能总汇
一.常用控件 文本框:输入文字或表达式 表格:设置表格的行列数,输入数字或表达式 子报表:放置子报表后,系统会自动增加一个页面,你可以在此页面上设计需要的报表.系统在打印处理时,先按主报表打印,当碰到 ...
- FastReport自定义数据源及ListView控件的使用
##1.想批量生成一堆物资信息卡,效果如下图所示,fastreport可以一下全部生成,并且发现不用单独写东西, ##2.发现FastReport官方给出的Demo.exe很友好,基本可以满足要求,想 ...
随机推荐
- jq实现点击按钮后倒计时,多用于手机验证
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- nodejs实践-MongoDB
nodejs实践-MongoDB laiqun@msn.cn Contents 1. 特点: 2. 开始使用 3. 使用Mongoose操作MongoDB 4. 在express中使用,组织数据库相关 ...
- 基于ATmgea8单片机设计的加热控制系统(转)
源:http://blog.163.com/zhaojun_xf/blog/static/3005058020085102562729/ 1 引言 温度是工业生产中主要的被控参数之一,与之相关的各种温 ...
- App installation failed There was an internal API error.
工程名为汉字的时候,真机调试会出现这种问题.模拟器没有问题. 如图: 解决办法:
- Eclipse/MyEclipse 最最常用的快捷键
F 键类 F2 显示详细信息 F3 跳到声明或定义的地方 Ctrl + 键类 Ctrl+1 快速修复 ( 最经典的快捷键 , 就不用多说了 ) Ctrl+D 删除当前行 Ctrl+E 快速显示当前 E ...
- 转:web_custom_request 和 web_submit_data的差别
web_custom_request方法可以发送POST和GET类型的请求 web_submit_data只能发送POST类型的请求 所有web_submit_data方法发送的请求都可以使用web_ ...
- Quartz总结(二):定时任务中使用业务类(XXService)
零.引言 上一篇文章:讲到了Spring集成Quartz的几种基本方法. 在实际使用的时候,往往会在定时任务中调用某个业务类中的方法,此时使用QuartzJobBean和MethodInvokeJob ...
- OpenCV学习笔记(27)KAZE 算法原理与源码分析(一)非线性扩散滤波
http://blog.csdn.net/chenyusiyuan/article/details/8710462 OpenCV学习笔记(27)KAZE 算法原理与源码分析(一)非线性扩散滤波 201 ...
- 转 Android HttpClient post MultipartEntity - Android 上传文件
转自 http://blog.csdn.net/hellohaifei/article/details/9707089 在Android 中使用HttpClient,MultipartEntity ...
- ural1470 UFOs
UFOs Time limit: 2.0 secondMemory limit: 64 MB Vasya is a ufologist and his duties include observing ...