找回密码
 立即注册

QQ登录

只需一步,快速开始

xinqinglhj

中级会员

19

主题

89

帖子

653

积分

中级会员

积分
653
xinqinglhj
中级会员   /  发表于:2018-7-25 18:18  /   查看:5294  /  回复:10
ActiveReports 版本为 12

PageFooter显示的数据为上一页的数据,只有第一页显示正确。

我是传递的是json数据。每一条数据都有footer的数据。
如:
A       B       C
1       1       1
2       1       1
3       1       1
4       1       1
5       1       2
6       1       2
7       1       2
8       1       2
9       1       3
10       1       3
11       1       3
12       1       3


一页显示4条数据,按照c分组,但是分组正确,footer的数据显示:
1页  1
2页  1
3页   2

10 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-7-26 09:14:33
沙发
你的意思是页脚显示的页码数不正确是吧!你把 你设计的报表发过来。我这边看看具体是什么原因导致的
回复 使用道具 举报
xinqinglhj
中级会员   /  发表于:2018-7-26 14:42:44
板凳
本帖最后由 xinqinglhj 于 2018-7-26 15:05 编辑






不好意思上面的图片顺序乱了,第一页在下面
数据源用的csv文件
一页显示17条明细,
A100 的数据 正好满两页,最后一页应该打印groupfooter,groupfooter打印在了第三页,第三页只有一个groupfooter。

1.能否将第三页的groupfooter打印到第二页的底部,因为第三页只有groupfooter没有其他数据。
  显示groupfooter的页,明细变成了16条,能否每页始终是17条数据。

2.控件(txtFooter01)是通过绑定字段(TItem01_07)进行赋值,是不是应该始终打印当前页的第一条数据。
  第一二页数据显示正确,后面的显示就不正确了。第二页以后的数据貌似显示的前一页的数据。
3.控件(txtFooter02)是在Detail_Format中进行设置的数据,是否应该显示明细中的最后一条数据?但是显示也不对。
4.控件(txtFooter022)是在Detail_Format中进行设置数据的,但是前提是Detail.IsRepeated=false的时候。
  txtFooter022现实的 内容是不是应该也是明细的最后一条的数据,
  结果:除了第一页之外,其他页都是对的。
5.控件(txtFooter03)在ActiveReport_FetchData进行赋值,是否应该显示当前页的最后一条明细,结果:显示次页的数据。





本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
xinqinglhj
中级会员   /  发表于:2018-7-26 14:43:47
地板
下面是报表的代码:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <ActiveReportsLayout Version="3.2" PrintWidth="14835.61" DocumentName="ActiveReports Document" ScriptLang="C#" MasterReport="0">
  3.   <StyleSheet>
  4.     <Style Name="Normal" Value="font-family: MS UI Gothic; font-style: normal; text-decoration: none; font-weight: normal; font-size: 10pt; color: Black; text-align: left; vertical-align: top; ddo-char-set: 128" />
  5.     <Style Name="Heading1" Value="font-family: MS UI Gothic; font-size: 16pt; font-style: normal; font-weight: bold" />
  6.     <Style Name="Heading2" Value="font-family: MS UI Gothic; font-size: 14pt; font-style: normal; font-weight: bold" />
  7.     <Style Name="Heading3" Value="font-family: MS UI Gothic; font-size: 13pt; font-style: normal; font-weight: bold" />
  8.   </StyleSheet>
  9.   <Sections>
  10.     <Section Type="PageHeader" Name="PageHeader" Height="1740.024" BackColor="16777215">
  11.       <Control Type="AR.Label" Name="Label2" Left="0" Top="90.14173" Width="1440" Height="288" Caption="項目1" />
  12.       <Control Type="AR.Field" Name="TextBox5" DataField="TItem01_01" Left="1604.976" Top="90.14171" Width="1440" Height="288" Text="TextBox5" />
  13.       <Control Type="AR.ReportInfo" Name="ReportInfo1" Left="10470.05" Top="90.14173" Width="1440" Height="288" FormatString="{PageNumber} / {PageCount} ページ" />
  14.     </Section>
  15.     <Section Type="GroupHeader" Name="GroupHeader1" Height="1435.68" DataField="TItem01_01" GroupKeepTogether="1" RepeatStyle="1" BackColor="16777215" NewPage="1" KeepTogether="1">
  16.       <Control Type="AR.Label" Name="Label1" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="0" Top="1141.795" Width="1440" Height="288" Caption="項目2 3" Style="vertical-align: middle" />
  17.       <Control Type="AR.Label" Name="Label3" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="1440" Top="1141.795" Width="1440" Height="288" Caption="項目4 4" Style="vertical-align: middle" />
  18.       <Control Type="AR.Label" Name="Label4" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="2880" Top="1141.795" Width="1440" Height="288" Caption="項目5 6" Style="vertical-align: middle" />
  19.       <Control Type="AR.Label" Name="Label5" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="4320" Top="1141.795" Width="1440" Height="288" Caption="項目7" Style="vertical-align: middle" />
  20.       <Control Type="AR.Line" Name="Line2" X1="0" Y1="1429.795" X2="5760" Y2="1429.795" />
  21.       <Control Type="AR.Field" Name="TextBox1" DataField="TItem01_01" Left="201.6" Top="0" Width="1785.6" Height="315.2126" Text="TItem01_01" Style="vertical-align: top" LineSpacing="3" />
  22.       <Control Type="AR.Field" Name="TextBox9" Left="7290.72" Top="315.36" Width="3179.52" Height="288" Text="TextBox9   TItem01_01" />
  23.       <Control Type="AR.Label" Name="Label6" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="8264.16" Top="1147.68" Width="1440" Height="288" Caption="Detail_Format" Style="vertical-align: middle" />
  24.       <Control Type="AR.Label" Name="Label7" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="11910.24" Top="1141.92" Width="1874.88" Height="288" Caption="AR_FetchData" Style="vertical-align: middle" />
  25.       <Control Type="AR.Label" Name="Label8" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="6824.161" Top="1141.92" Width="1440" Height="288" Caption="DataField" Style="vertical-align: middle" />
  26.       <Control Type="AR.Label" Name="Label9" BorderLeftStyle="1" BorderTopStyle="1" BorderRightStyle="1" BorderBottomStyle="1" Left="9704.16" Top="1147.68" Width="1860.48" Height="288" Caption="Detail_Format repeat" Style="vertical-align: middle" />
  27.     </Section>
  28.     <Section Type="Detail" Name="Detail" Height="435" RepeatToFill="1" BackColor="16777215">
  29.       <Control Type="AR.Field" Name="TextBox2" DataField="TItem01_04" Left="1440" Top="0" Width="1440" Height="315.2126" Text="TItem01_04" Style="vertical-align: top" LineSpacing="3" />
  30.       <Control Type="AR.Field" Name="txtItem05" DataField="TItem01_05" Left="2880" Top="0" Width="1440" Height="315.2126" Text="txtItem05" Style="vertical-align: top" LineSpacing="3" />
  31.       <Control Type="AR.Field" Name="TextBox4" Left="8264.16" Top="0" Width="1440" Height="315.2126" Text="TItem01_07" Style="color: MediumSeaGreen; text-decoration: none; vertical-align: top; ddo-char-set: 1" LineSpacing="3" />
  32.       <Control Type="AR.Field" Name="TextBox7" DataField="TItem01_03" Left="0" Top="0" Width="1440.001" Height="315.2126" Text="TItem01_03" Style="vertical-align: top" LineSpacing="3" />
  33.       <Control Type="AR.Line" Name="Line1" X1="0" Y1="390.2401" X2="5760" Y2="390.2401" />
  34.       <Control Type="AR.Field" Name="TextBox11" DataField="TItem01_06" Left="4320" Top="0" Width="1440" Height="315.2126" Text="txtItem06" Style="vertical-align: top" LineSpacing="3" />
  35.       <Control Type="AR.Field" Name="TextBox17" Left="11910.24" Top="0" Width="1440" Height="315.2126" Text="TItem01_08" Style="color: Red; vertical-align: top" LineSpacing="3" />
  36.       <Control Type="AR.Field" Name="TextBox10" DataField="TItem01_07" Left="6824.161" Top="0" Width="1440" Height="315.2126" Text="TItem01_07" Style="color: Red; vertical-align: top" LineSpacing="3" />
  37.       <Control Type="AR.Field" Name="TextBox3" Left="5760" Top="0" Width="1064.16" Height="315.2126" Text="TItem01_07" Style="color: MediumSeaGreen; text-decoration: none; vertical-align: top; ddo-char-set: 1" LineSpacing="3" />
  38.       <Control Type="AR.Field" Name="TextBox6" Left="9704.16" Top="0" Width="1440" Height="315.2126" Text="TItem01_07" Style="color: MediumSeaGreen; text-decoration: none; vertical-align: top; ddo-char-set: 1" LineSpacing="3" />
  39.     </Section>
  40.     <Section Type="GroupFooter" Name="GroupFooter1" PrintAtBottom="1" Height="510" BackColor="16777215" KeepTogether="1">
  41.       <Control Type="AR.Field" Name="TextBox13" DataField="TItem01_02" Left="374.4" Top="0" Width="1440" Height="288" Text="TextBox13" Style="color: Red" />
  42.     </Section>
  43.     <Section Type="PageFooter" Name="PageFooter" Height="644.9999" BackColor="16777215">
  44.       <Control Type="AR.Field" Name="TextBox12" Left="1440" Top="210.24" Width="1440" Height="288" Text="TextBox12" />
  45.       <Control Type="AR.Field" Name="TextBox14" Left="3509.28" Top="210.24" Width="1440" Height="288" Text="TextBox14" Style="font-family: MS 明朝; ddo-char-set: 1" />
  46.       <Control Type="AR.Field" Name="TextBox15" Left="5024.16" Top="210.24" Width="1440" Height="288" Text="TextBox15" Style="font-family: MS 明朝; ddo-char-set: 1" />
  47.       <Control Type="AR.Field" Name="txtFooter01" DataField="TItem01_07" Left="6973.92" Top="119.52" Width="1440" Height="288" Text="TItem01_07" Style="color: Red" />
  48.       <Control Type="AR.Field" Name="txtFooter02" Left="8264.16" Top="119.52" Width="1440" Height="288" Text="TextBox18" Style="color: MediumSeaGreen" />
  49.       <Control Type="AR.Field" Name="txtFooter03" Left="11910.24" Top="0" Width="1440" Height="288" Text="TextBox19" Style="color: Red" />
  50.       <Control Type="AR.Field" Name="txtFooter022" Left="9853.921" Top="119.52" Width="1440" Height="288" Text="TextBox18" Style="color: MediumSeaGreen" />
  51.     </Section>
  52.   </Sections>
  53.   <ReportComponentTray />
  54.   <Script><![CDATA[/**
  55. public void ActiveReport_ReportStart()
  56. {
  57.         foreach (ARControl c in Detail.Controls)
  58.         {
  59.                 c.Top = 0;
  60.         }
  61.         Detail.Height = 0.169F;
  62. }
  63. */
  64. /**
  65. public void Detail_Format()
  66. {
  67.         foreach (ARControl c in Detail.Controls)
  68.         {
  69.                 c.Top = 0;
  70.         }
  71.         Detail.Height = 0.169F;
  72.        

  73. }
  74. */
  75. /**
  76. public void Detail_BeforePrint()
  77. {
  78.         float maxHeight = 0;
  79.         foreach (ARControl c in Detail.Controls)
  80.         {
  81.                 if (c is TextBox)
  82.                 {
  83.                         if (c.Name == "txtItem05")
  84.                         {
  85.                                 float temp = c.Height + txtItem06.Height;
  86.                                 if (temp > maxHeight)
  87.                                 {
  88.                                         maxHeight = temp;
  89.                                 }

  90.                         } else {
  91.                                 if (c.Height > maxHeight)
  92.                                 {
  93.                                         maxHeight = c.Height;
  94.                                 }
  95.                         }

  96.                 }
  97.         }
  98.        
  99.         foreach (ARControl c in Detail.Controls)
  100.         {
  101.                 if (c is TextBox)
  102.                 {
  103.                         if (c.Name == "txtItem05" || c.Name == "txtItem06")
  104.                         {
  105.                         } else {
  106.                                 c.Height = maxHeight;
  107.                         }
  108.                        
  109.                 }
  110.         }
  111. */
  112. /**
  113.         foreach (ARControl c in Detail.Controls)
  114.         {
  115.                 if (c is TextBox)
  116.                 {
  117.                         c.Visible = false;
  118.                 }
  119.         }
  120.         string strModes = txtFlag.Text;
  121.         TextBox9.Text = strModes;
  122.         switch (strModes)
  123.         {
  124.                 //
  125.                 case "I1":
  126.                         TextBox1.Visible = true;
  127.                         TextBox2.Visible = true;
  128.                         TextBox3.Visible = true;
  129.                         TextBox4.Visible = true;
  130.                         TextBox5.Visible = true;
  131.                        
  132.                         break;
  133.                 case "I2":
  134.                         TextBox6.Visible = true;
  135.                         TextBox7.Visible = true;
  136.                         TextBox8.Visible = true;
  137.                         TextBox9.Visible = true;
  138.                         break;               

  139.         }

  140. }
  141. */
  142. int cnt = 0;
  143. public void Detail_Format()
  144. {
  145. //        rpt.Document.Pages[0].
  146.         cnt++;
  147.         TextBox3.Text = cnt.ToString();
  148.        
  149.         //TextBox6.Text = GroupFooter1.Visible.ToString();
  150.         //TextBox8.Text = GroupFooter1.IsRepeated.ToString();
  151.         if (Detail.IsRepeated)
  152.         {
  153.         }
  154.         else
  155.         {
  156.                
  157.                 TextBox6.Text  = rpt.Fields["TItem01_07"].Value.ToString();
  158.                 txtFooter022.Text = rpt.Fields["TItem01_07"].Value.ToString();
  159.         }
  160.        
  161.         TextBox4.Text = rpt.Fields["TItem01_07"].Value.ToString();
  162.        
  163.         txtFooter02.Text = rpt.Fields["TItem01_07"].Value.ToString();
  164.        
  165. }


  166. public void PageHeader_BeforePrint()
  167. {

  168. }


  169. public void PageHeader_Format()
  170. {
  171.         cnt = 0;

  172. }


  173. public void PageHeader_AfterPrint()
  174. {

  175. }


  176. public void GroupHeader1_Format()
  177. {

  178. }


  179. public void GroupFooter1_Format()
  180. {
  181.         flag = "1";

  182. }

  183. string flag = "";
  184. public void ActiveReport_DataInitialize()
  185. {
  186.         flag = "";
  187. }

  188. string str08 = "";
  189. string str07 = "";
  190. public bool ActiveReport_FetchData(bool eof)
  191. {
  192.         str08 = rpt.Fields["TItem01_08"].Value.ToString();
  193.        
  194.         str07 = rpt.Fields["TItem01_07"].Value.ToString();
  195.        
  196.         txtFooter03.Text = str07;
  197.        
  198.         TextBox17.Text = str08;
  199.        
  200.         return eof;
  201. }


  202. public void ActiveReport_NoData()
  203. {
  204.        
  205. }


  206. public void GroupFooter1_AfterPrint()
  207. {
  208.         flag = "";
  209. //        TextBox11.Width
  210. }


  211. public void PageFooter_Format()
  212. {
  213.         TextBox13.Font = new Font(TextBox13.Font.Name, 14);
  214.         // TextBox13.Font = 15; NG
  215.        
  216.         TextBox14.Text = TextBox14.Font.Name;

  217.         if (flag == "1")
  218.         {
  219.                 TextBox12.Text = "111111";
  220.         } else {
  221.                 TextBox12.Text = "";
  222.         }
  223.        
  224. }


  225. public void PageFooter_BeforePrint()
  226. {
  227.        
  228. }


  229. public void PageFooter_AfterPrint()
  230. {
  231.        
  232. }


  233. ]]></Script>
  234.   <PageSettings LeftMargin="283" RightMargin="283" TopMargin="283" BottomMargin="283" Orientation="2" />
  235.   <Parameters />
  236. </ActiveReportsLayout>
复制代码
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-7-26 15:21:09
5#
能提供你的联系方式吗? 我跟你电话沟通下。
回复 使用道具 举报
xinqinglhj
中级会员   /  发表于:2018-7-26 18:16:50
6#
不好意思,好像没有说明白,举个简单的例子吧。测试数据
A       B       C
1       1       1
2       2       2

区域报表按照A字段分组,pageheader 有个字段 绑定 A的数据。pagefooter绑定B的数据,这样的话显示两页没有问题。
执行结果:
页码    pageheader  pagefooter
1       1               1
2       2               1

第二页的pagefooter显示不对,实际上如果数据多的话,从第二页开始,pagefooter显示的前一页的数据。
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-7-27 17:16:46
7#
个人建议是使用RDl报表,RDl报表的功能比区域报表的功能要更强大,也能完全满足你分组的需求。
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-7-31 11:52:25
8#
你好!测试你的数据后,现在得出结论。页脚的数据如果绑定的是数据字段的话,显示的时候是变化的,每次显示的都是上一页的最后一行数据。
回复 使用道具 举报
xinqinglhj
中级会员   /  发表于:2018-7-31 12:35:50
9#
KearneyKang 发表于 2018-7-31 11:52
你好!测试你的数据后,现在得出结论。页脚的数据如果绑定的是数据字段的话,显示的时候是变化的,每次显示 ...

应该是从第二页开始显示的是上一页的最后一条数据。(但是我发现最后一条数据不一定是在上一页)
这个应该属于不正常吧?是这个工具的Bug吗?由其他的解决办法吗?
回复 使用道具 举报
xinqinglhj
中级会员   /  发表于:2018-7-31 15:51:37
10#
KearneyKang 发表于 2018-7-31 11:52
你好!测试你的数据后,现在得出结论。页脚的数据如果绑定的是数据字段的话,显示的时候是变化的,每次显示 ...

像我这种情况,pagefooter的数据,应该怎么正确显示呢?
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部