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很友好,基本可以满足要求,想 ...
随机推荐
- Android Studio的使用(八)--// TODO代码
我们都知道Eclipse存在// TODO代码,该段代码在方法中用于标识该方法仍未完成,也可以用于作为该方法的一个快捷键.例如我们可以用于标识onClick()方法,当我们需要查找onClick()方 ...
- JS跨域代码
//部分JS代码 $.ajax({ async: false, url: "http://www.xxxx.com/api/", type: "GET",//不 ...
- 页面新宠图片格式WebP
WebP格式,谷歌(google)开发的一种旨在加快图片加载速度的图片格式.图片压缩体积大约只有JPEG的2/3,并能节省大量的服务器带宽资源和数据空间.Facebook Ebay等知名网站已经开始测 ...
- FusionCharts生成报表应用
1.需要组装要展示的数据,至于如何怎样去设计数据模型,看你要展示的图形和需要的数据就行了.来个简单的. 实体类,只有两个属性,也可以使用Bean里面的实体类,无所谓了. package com.gol ...
- 条形图(diagrams)
条形图(diagrams) 题目描述 小 虎刚上了幼儿园,老师让他做一个家庭作业:首先画3行格子,第一行有3个格子,第二行有2个格子,第三行有3个格子.每行的格子从左到右可以放棋子,但要 求除第一行外 ...
- android脚步---设置layout隐藏属性
设置layout的属性,应用到android view的setVisibility 有三个值 visibility VISIBLE, INVISIBLE, GONE. 可见的 不可见的 ...
- java日期格式大全 format SimpleDateFormat(转)
java日期格式大全 format SimpleDateFormat /** * 字符串转换为java.util.Date<br> * 支持格式为 yyyy.MM.dd G ...
- BroadcastReceiver的两种注册方式之------动态注册
activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android&qu ...
- BNUOJ 6038 - Reaux! Sham! Beaux!(模拟)
这是一个水模拟,但是因为图片看不清,手打比较烧脑,我们错了好多次才过 #include<stdio.h> #include<iostream> #include<stri ...
- 转:Loadrunner上传文件解决办法(大文件)
最近再做一个跟海量存储相关的项目测试,需要通过LR模拟用户大量上传和下载文件,请求是Rest或Soap,同时还要模拟多种大小尺寸不一的文件 通常情况下,都是使用简单的post协议即可: 方法一: we ...