xinqinglhj 发表于 2018-7-25 18:18:27

PageFooter显示的数据为上一页的数据

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

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进行赋值,是否应该显示当前页的最后一条明细,结果:显示次页的数据。





xinqinglhj 发表于 2018-7-26 14:43:47

下面是报表的代码:

<?xml version="1.0" encoding="UTF-8"?>
<ActiveReportsLayout Version="3.2" PrintWidth="14835.61" DocumentName="ActiveReports Document" ScriptLang="C#" MasterReport="0">
<StyleSheet>
    <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" />
    <Style Name="Heading1" Value="font-family: MS UI Gothic; font-size: 16pt; font-style: normal; font-weight: bold" />
    <Style Name="Heading2" Value="font-family: MS UI Gothic; font-size: 14pt; font-style: normal; font-weight: bold" />
    <Style Name="Heading3" Value="font-family: MS UI Gothic; font-size: 13pt; font-style: normal; font-weight: bold" />
</StyleSheet>
<Sections>
    <Section Type="PageHeader" Name="PageHeader" Height="1740.024" BackColor="16777215">
      <Control Type="AR.Label" Name="Label2" Left="0" Top="90.14173" Width="1440" Height="288" Caption="項目1" />
      <Control Type="AR.Field" Name="TextBox5" DataField="TItem01_01" Left="1604.976" Top="90.14171" Width="1440" Height="288" Text="TextBox5" />
      <Control Type="AR.ReportInfo" Name="ReportInfo1" Left="10470.05" Top="90.14173" Width="1440" Height="288" FormatString="{PageNumber} / {PageCount} ページ" />
    </Section>
    <Section Type="GroupHeader" Name="GroupHeader1" Height="1435.68" DataField="TItem01_01" GroupKeepTogether="1" RepeatStyle="1" BackColor="16777215" NewPage="1" KeepTogether="1">
      <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" />
      <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" />
      <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" />
      <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" />
      <Control Type="AR.Line" Name="Line2" X1="0" Y1="1429.795" X2="5760" Y2="1429.795" />
      <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" />
      <Control Type="AR.Field" Name="TextBox9" Left="7290.72" Top="315.36" Width="3179.52" Height="288" Text="TextBox9   TItem01_01" />
      <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" />
      <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" />
      <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" />
      <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" />
    </Section>
    <Section Type="Detail" Name="Detail" Height="435" RepeatToFill="1" BackColor="16777215">
      <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" />
      <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" />
      <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" />
      <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" />
      <Control Type="AR.Line" Name="Line1" X1="0" Y1="390.2401" X2="5760" Y2="390.2401" />
      <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" />
      <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" />
      <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" />
      <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" />
      <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" />
    </Section>
    <Section Type="GroupFooter" Name="GroupFooter1" PrintAtBottom="1" Height="510" BackColor="16777215" KeepTogether="1">
      <Control Type="AR.Field" Name="TextBox13" DataField="TItem01_02" Left="374.4" Top="0" Width="1440" Height="288" Text="TextBox13" Style="color: Red" />
    </Section>
    <Section Type="PageFooter" Name="PageFooter" Height="644.9999" BackColor="16777215">
      <Control Type="AR.Field" Name="TextBox12" Left="1440" Top="210.24" Width="1440" Height="288" Text="TextBox12" />
      <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" />
      <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" />
      <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" />
      <Control Type="AR.Field" Name="txtFooter02" Left="8264.16" Top="119.52" Width="1440" Height="288" Text="TextBox18" Style="color: MediumSeaGreen" />
      <Control Type="AR.Field" Name="txtFooter03" Left="11910.24" Top="0" Width="1440" Height="288" Text="TextBox19" Style="color: Red" />
      <Control Type="AR.Field" Name="txtFooter022" Left="9853.921" Top="119.52" Width="1440" Height="288" Text="TextBox18" Style="color: MediumSeaGreen" />
    </Section>
</Sections>
<ReportComponentTray />
<Script><![CDATA[/**
public void ActiveReport_ReportStart()
{
        foreach (ARControl c in Detail.Controls)
        {
                c.Top = 0;
        }
        Detail.Height = 0.169F;
}
*/
/**
public void Detail_Format()
{
        foreach (ARControl c in Detail.Controls)
        {
                c.Top = 0;
        }
        Detail.Height = 0.169F;
       

}
*/
/**
public void Detail_BeforePrint()
{
        float maxHeight = 0;
        foreach (ARControl c in Detail.Controls)
        {
                if (c is TextBox)
                {
                        if (c.Name == "txtItem05")
                        {
                                float temp = c.Height + txtItem06.Height;
                                if (temp > maxHeight)
                                {
                                        maxHeight = temp;
                                }

                        } else {
                                if (c.Height > maxHeight)
                                {
                                        maxHeight = c.Height;
                                }
                        }

                }
        }
       
        foreach (ARControl c in Detail.Controls)
        {
                if (c is TextBox)
                {
                        if (c.Name == "txtItem05" || c.Name == "txtItem06")
                        {
                        } else {
                                c.Height = maxHeight;
                        }
                       
                }
        }
*/
/**
        foreach (ARControl c in Detail.Controls)
        {
                if (c is TextBox)
                {
                        c.Visible = false;
                }
        }
        string strModes = txtFlag.Text;
        TextBox9.Text = strModes;
        switch (strModes)
        {
                //
                case "I1":
                        TextBox1.Visible = true;
                        TextBox2.Visible = true;
                        TextBox3.Visible = true;
                        TextBox4.Visible = true;
                        TextBox5.Visible = true;
                       
                        break;
                case "I2":
                        TextBox6.Visible = true;
                        TextBox7.Visible = true;
                        TextBox8.Visible = true;
                        TextBox9.Visible = true;
                        break;               

        }

}
*/
int cnt = 0;
public void Detail_Format()
{
//        rpt.Document.Pages.
        cnt++;
        TextBox3.Text = cnt.ToString();
       
        //TextBox6.Text = GroupFooter1.Visible.ToString();
        //TextBox8.Text = GroupFooter1.IsRepeated.ToString();
        if (Detail.IsRepeated)
        {
        }
        else
        {
               
                TextBox6.Text= rpt.Fields["TItem01_07"].Value.ToString();
                txtFooter022.Text = rpt.Fields["TItem01_07"].Value.ToString();
        }
       
        TextBox4.Text = rpt.Fields["TItem01_07"].Value.ToString();
       
        txtFooter02.Text = rpt.Fields["TItem01_07"].Value.ToString();
       
}


public void PageHeader_BeforePrint()
{

}


public void PageHeader_Format()
{
        cnt = 0;

}


public void PageHeader_AfterPrint()
{

}


public void GroupHeader1_Format()
{

}


public void GroupFooter1_Format()
{
        flag = "1";

}

string flag = "";
public void ActiveReport_DataInitialize()
{
        flag = "";
}

string str08 = "";
string str07 = "";
public bool ActiveReport_FetchData(bool eof)
{
        str08 = rpt.Fields["TItem01_08"].Value.ToString();
       
        str07 = rpt.Fields["TItem01_07"].Value.ToString();
       
        txtFooter03.Text = str07;
       
        TextBox17.Text = str08;
       
        return eof;
}


public void ActiveReport_NoData()
{
       
}


public void GroupFooter1_AfterPrint()
{
        flag = "";
//        TextBox11.Width
}


public void PageFooter_Format()
{
        TextBox13.Font = new Font(TextBox13.Font.Name, 14);
        // TextBox13.Font = 15; NG
       
        TextBox14.Text = TextBox14.Font.Name;

        if (flag == "1")
        {
                TextBox12.Text = "111111";
        } else {
                TextBox12.Text = "";
        }
       
}


public void PageFooter_BeforePrint()
{
       
}


public void PageFooter_AfterPrint()
{
       
}


]]></Script>
<PageSettings LeftMargin="283" RightMargin="283" TopMargin="283" BottomMargin="283" Orientation="2" />
<Parameters />
</ActiveReportsLayout>

KearneyKang 发表于 2018-7-26 15:21:09

能提供你的联系方式吗? 我跟你电话沟通下。

xinqinglhj 发表于 2018-7-26 18:16:50

不好意思,好像没有说明白,举个简单的例子吧。测试数据
A       B       C
1       1       1
2       2       2

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

第二页的pagefooter显示不对,实际上如果数据多的话,从第二页开始,pagefooter显示的前一页的数据。

KearneyKang 发表于 2018-7-27 17:16:46

个人建议是使用RDl报表,RDl报表的功能比区域报表的功能要更强大,也能完全满足你分组的需求。

KearneyKang 发表于 2018-7-31 11:52:25

你好!测试你的数据后,现在得出结论。页脚的数据如果绑定的是数据字段的话,显示的时候是变化的,每次显示的都是上一页的最后一行数据。

xinqinglhj 发表于 2018-7-31 12:35:50

KearneyKang 发表于 2018-7-31 11:52
你好!测试你的数据后,现在得出结论。页脚的数据如果绑定的是数据字段的话,显示的时候是变化的,每次显示 ...

应该是从第二页开始显示的是上一页的最后一条数据。(但是我发现最后一条数据不一定是在上一页)
这个应该属于不正常吧?是这个工具的Bug吗?由其他的解决办法吗?

xinqinglhj 发表于 2018-7-31 15:51:37

KearneyKang 发表于 2018-7-31 11:52
你好!测试你的数据后,现在得出结论。页脚的数据如果绑定的是数据字段的话,显示的时候是变化的,每次显示 ...

像我这种情况,pagefooter的数据,应该怎么正确显示呢?
页: [1] 2
查看完整版本: PageFooter显示的数据为上一页的数据