注意我的是winform程序,是C#。绑定了一个数据源是dataset,数据传输,小票样式也已经设置好了。但是由于dataset每次包含的数据量不同,所以一张标准的80*210的纸有时候只占三分之一,有时候会打多张,而且每一张的下面都会有空白,最后一张可能只占了一行。
这就很纠结了。怎么样才能自定义纸张的高度,恰好把内容打印到小票上呢。
ps:自己研究了半天总算是有了点眉目,但是Data1的高度貌似乘以2了。以下是我在frx文件中编辑的代码。请各位大神指正。求合理的解决方案using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;namespace FastReport
{
public class ReportScript
{
private void Page1_StartPage(object sender, EventArgs e)
{
Page1.PaperHeight=ReportTitle1.Height+ Data1.Height+GroupFooter1.Height;
}
}
}
这就很纠结了。怎么样才能自定义纸张的高度,恰好把内容打印到小票上呢。
ps:自己研究了半天总算是有了点眉目,但是Data1的高度貌似乘以2了。以下是我在frx文件中编辑的代码。请各位大神指正。求合理的解决方案using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;namespace FastReport
{
public class ReportScript
{
private void Page1_StartPage(object sender, EventArgs e)
{
Page1.PaperHeight=ReportTitle1.Height+ Data1.Height+GroupFooter1.Height;
}
}
}
解决方案 »
- c#windows 带数据库打包问题
- cmd.Parameters.AddWithValue("@A", "null"); 这是给数据库输入null?
- 有关SOCKET的Windows服务问题。
- 点击项目文件VS说无法从web服务器获取项目文件
- VB版的:本以为很简单的问题,贴了两天都没人回答,现在加到100分,帮顶的也有分,谢了
- 急问:.net中当把用户输入的一个字符串存入varchar型的sql server数据库中,一般怎么处理转义符?
- CLR 无法从 COM 上下文 0x1a3008 转换为 COM 上下文 0x1a3178,这种状态已持续 60 秒
- 新手求教
- gridview里面嵌入checkbox
- 新手上路.在C#中WebBrowser控件在那里,怎么用啊
- 问个用C#抓取网页表格的问题
- winform panel 滚动条滑动问题
http://www.evget.com/zh-cn/evquestions/viewinfo.aspx?qid=1775现在因为数据源中的包含有多个订单信息和每个订单信息下的物品信息,所以使用了分组专家,这样的话原本已经解决的自定义纸张高度的解决方案不适用了。求改进后的解决方案
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing;
using System.Data;
using FastReport;
using FastReport.Data;
using FastReport.Dialog;
using FastReport.Barcode;
using FastReport.Table;
using FastReport.Utils;namespace FastReport
{
public class ReportScript
{
private float reportTitle1Height;
private float pageHeader1Height;
private float groupHeader1Height;
private float data1Height;
private float data2Height;
private float groupFood1Height;
private float pageFooter1Height;
private void Page1_StartPage(object sender, EventArgs e)
{
if(Engine.FinalPass)
{
if(Report.GetParameterValue("TitleName").ToString().Contains("并单"))
{
Text12.Visible=true;
Text13.Visible=true;
}
Page1.PaperHeight = (reportTitle1Height + pageHeader1Height+groupHeader1Height+data1Height+data2Height+groupFood1Height+pageFooter1Height)/Units.Millimeters+ Page1.TopMargin +Page1.BottomMargin;
}
}
//报表标题的高度
private void ReportTitle1_AfterLayout(object sender, EventArgs e)
{
reportTitle1Height=ReportTitle1.Height;
}
//页眉区的高度
private void PageHeader1_AfterLayout(object sender, EventArgs e)
{
pageHeader1Height=PageHeader1.Height;
}
//GroupHeader1的高度
private void GroupHeader1_AfterLayout(object sender, EventArgs e)
{
groupHeader1Height+=GroupHeader1.Height;
}
//Data1的高度
private void Data1_AfterLayout(object sender, EventArgs e)
{
data1Height+=Data1.Height;
}
//Data2的高度
private void Data2_AfterLayout(object sender, EventArgs e)
{
data2Height+=Data2.Height;
}
//GroupFooter1的高度
private void GroupFooter1_AfterLayout(object sender, EventArgs e)
{
groupFood1Height+=GroupFooter1.Height;
}
//页脚区高度
private void PageFooter1_AfterLayout(object sender, EventArgs e)
{
pageFooter1Height=PageFooter1.Height;
}
}
}