找回密码
 立即注册

QQ登录

只需一步,快速开始

beitesting

中级会员

28

主题

92

帖子

794

积分

中级会员

积分
794

活字格认证

beitesting
中级会员   /  发表于:2018-3-19 17:53  /   查看:7006  /  回复:15
AR for.NET11.0分页打印时PageHeader的内容不对。在A3纸张上,打印两列分别是BOSS和User。其中Boss打印在PageHeader上,User打印在明细上。
共120条数据,期待是每40条打印一页,而且每页开头的Boss依次是第1条,第41条和第81条。
但实际结果是,确实每页打印了40条,明细都很正常,但是从第二页开始,PageHeader的BOSS就成了第42条和第82条了。

公司不能上传任何附件,请谅解。




15 个回复

倒序浏览
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-3-20 09:35:56
沙发
您好!
我有点不是很清楚您具体想实现的需求,你可以不上传附件,但是您能通过截图把重要信息给做处理,然后告诉我当前是什么啥情况,然后分页后想要实现什么效果,用截图说明下,重要信息做模糊处理
回复 使用道具 举报
beitesting
中级会员   /  发表于:2018-3-20 10:09:48
板凳
D:\img01.jpg附件上传完成!成功 0 个,失败 1 个:
img01.jpg: 内部服务器错误
我划个示意图吧
数据如下
Boss_CD     User_CD
10000         30000
10001         30001
... ....             ... ...
10119         30119

ActiveReport的布局如下
第一页:
BOSS:10000
            USER
===============================
10000  30000
... ....      ... ...
10039  30039

第二页:
BOSS:10041
            USER
===============================
10040  30040
... ....      ... ...
10079  30079


第三页:
BOSS:10081
            USER
===============================
10080  30080
... ....      ... ...
10119  30119


其中,第二页的[BOSS:10041]是错误的,期望的是打印出这页的第一条明细的boss_cd ,也就是期待的是打印出10040
另外第三页的[BOSS:10081]也是错误的,期待的是打印结果是10080。

回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-3-20 11:39:41
地板
您好!
你现在的问题是翻页后,出现了数据不连续,自动加1了。
您的Boss_CD 和User_CD   是绑定的数据源,还是通过一个函数自动添加的。
现在因为我看不到您的具体设计,我没办法重现您的问题,然后去需求解决的办法,您最好能给我一个模板,不是您的当前模板,但是能反馈您问题的模板,然后就是测试数据。我需要先重现您的问题,然后再找解决思路
回复 使用道具 举报
beitesting
中级会员   /  发表于:2018-3-20 13:53:11
5#
Form1.vb:这个Form上就一个Button2
Imports GrapeCity.ActiveReports

Public Class Form1

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim dt As New DataTable
        Dim dCol As DataColumn
        Dim iRpt As New SectionReport1

        ' Create DataTabel
        dCol = New DataColumn()
        dCol.ColumnName = "SIRE_TANTO_CD"
        dt.Columns.Add(dCol)

        dCol = New DataColumn()
        dCol.ColumnName = "SIRE_CD"
        dt.Columns.Add(dCol)

        ' Create Data
        For idx As Integer = 0 To 119
            dt.Rows.Add(dt.NewRow)
            dt.Rows(idx).Item("SIRE_TANTO_CD") = 1000 + idx
            dt.Rows(idx).Item("SIRE_CD") = 3000 + idx
        Next

        ' Set DataSource
        iRpt.DataSource = dt

        'Set Printer
        iRpt.Document.Printer.PrinterName = "Microsoft XPS Document Writer"
        'Print
        iRpt.Run(True)
        'ReSet Printer
        iRpt.Document.Printer.PrinterName = "Microsoft XPS Document Writer"

        Try

            iRpt.Document.Print(False, False, False)
        Catch ex As Exception
            MessageBox.Show(ex.ToString)
            Return
        End Try

    End Sub
End Class
回复 使用道具 举报
beitesting
中级会员   /  发表于:2018-3-20 13:53:37
6#
SectionReport1.Designer.vb:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Public Class SectionReport1
    Inherits GrapeCity.ActiveReports.SectionReport

    'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
        End If
        MyBase.Dispose(disposing)
    End Sub

    'メモ: 以下のプロシージャは ActiveReports デザイナーで必要です。
    'ActiveReports デザイナーを使用して変更できます。  
    'コード エディターを使って変更しないでください。
    Private WithEvents PageHeader As GrapeCity.ActiveReports.SectionReportModel.PageHeader
    Private WithEvents Detail As GrapeCity.ActiveReports.SectionReportModel.Detail
    Private WithEvents PageFooter As GrapeCity.ActiveReports.SectionReportModel.PageFooter
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(SectionReport1))
        Me.PageHeader = New GrapeCity.ActiveReports.SectionReportModel.PageHeader()
        Me.Detail = New GrapeCity.ActiveReports.SectionReportModel.Detail()
        Me.PageFooter = New GrapeCity.ActiveReports.SectionReportModel.PageFooter()
        Me.ReportHeader1 = New GrapeCity.ActiveReports.SectionReportModel.ReportHeader()
        Me.ReportFooter1 = New GrapeCity.ActiveReports.SectionReportModel.ReportFooter()
        Me.lblSireTanto = New GrapeCity.ActiveReports.SectionReportModel.Label()
        Me.txtSireTantoCd = New GrapeCity.ActiveReports.SectionReportModel.TextBox()
        Me.Label1 = New GrapeCity.ActiveReports.SectionReportModel.Label()
        Me.txtSireCd = New GrapeCity.ActiveReports.SectionReportModel.TextBox()
        CType(Me.lblSireTanto, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.txtSireTantoCd, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.Label1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.txtSireCd, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
        '
        'PageHeader
        '
        Me.PageHeader.Controls.AddRange(New GrapeCity.ActiveReports.SectionReportModel.ARControl() {Me.lblSireTanto, Me.txtSireTantoCd, Me.Label1})
        Me.PageHeader.Height = 0.983!
        Me.PageHeader.Name = "PageHeader"
        '
        'Detail
        '
        Me.Detail.Controls.AddRange(New GrapeCity.ActiveReports.SectionReportModel.ARControl() {Me.txtSireCd})
        Me.Detail.Height = 0.24!
        Me.Detail.Name = "Detail"
        '
        'PageFooter
        '
        Me.PageFooter.Height = 0.302!
        Me.PageFooter.Name = "PageFooter"
        '
        'ReportHeader1
        '
        Me.ReportHeader1.Height = 0!
        Me.ReportHeader1.Name = "ReportHeader1"
        '
        'ReportFooter1
        '
        Me.ReportFooter1.Height = 0!
        Me.ReportFooter1.Name = "ReportFooter1"
        '
        'lblSireTanto
        '
        Me.lblSireTanto.Height = 0.1968504!
        Me.lblSireTanto.HyperLink = Nothing
        Me.lblSireTanto.Left = 0!
        Me.lblSireTanto.Name = "lblSireTanto"
        Me.lblSireTanto.Style = "font-family: MS 明朝; font-size: 11.25pt; text-align: left; vertical-align: middle"
        Me.lblSireTanto.Text = "BOSS:"
        Me.lblSireTanto.Top = 0.463!
        Me.lblSireTanto.Width = 0.9842521!
        '
        'txtSireTantoCd
        '
        Me.txtSireTantoCd.CanGrow = False
        Me.txtSireTantoCd.DataField = "SIRE_TANTO_CD"
        Me.txtSireTantoCd.Height = 0.1968504!
        Me.txtSireTantoCd.Left = 0.9842523!
        Me.txtSireTantoCd.MultiLine = False
        Me.txtSireTantoCd.Name = "txtSireTantoCd"
        Me.txtSireTantoCd.OutputFormat = resources.GetString("txtSireTantoCd.OutputFormat")
        Me.txtSireTantoCd.Style = "font-family: MS ゴシック; font-size: 11.25pt; text-align: right; vertical-align: midd" &
    "le"
        Me.txtSireTantoCd.Text = "00000"
        Me.txtSireTantoCd.Top = 0.463!
        Me.txtSireTantoCd.Width = 0.4330707!
        '
        'Label1
        '
        Me.Label1.Border.BottomStyle = GrapeCity.ActiveReports.BorderLineStyle.Solid
        Me.Label1.Border.LeftStyle = GrapeCity.ActiveReports.BorderLineStyle.Solid
        Me.Label1.Border.RightStyle = GrapeCity.ActiveReports.BorderLineStyle.Solid
        Me.Label1.Border.TopStyle = GrapeCity.ActiveReports.BorderLineStyle.Solid
        Me.Label1.Height = 0.1968504!
        Me.Label1.HyperLink = Nothing
        Me.Label1.Left = 0!
        Me.Label1.Name = "Label1"
        Me.Label1.Style = "font-family: MS 明朝; font-size: 11.25pt; text-align: left; vertical-align: middle"
        Me.Label1.Text = "User"
        Me.Label1.Top = 0.786!
        Me.Label1.Width = 0.5840001!
        '
        'txtSireCd
        '
        Me.txtSireCd.Border.BottomStyle = GrapeCity.ActiveReports.BorderLineStyle.Dash
        Me.txtSireCd.Border.LeftStyle = GrapeCity.ActiveReports.BorderLineStyle.Solid
        Me.txtSireCd.Border.RightStyle = GrapeCity.ActiveReports.BorderLineStyle.Solid
        Me.txtSireCd.CanGrow = False
        Me.txtSireCd.DataField = "SIRE_CD"
        Me.txtSireCd.Height = 0.24!
        Me.txtSireCd.Left = 0!
        Me.txtSireCd.MultiLine = False
        Me.txtSireCd.Name = "txtSireCd"
        Me.txtSireCd.OutputFormat = resources.GetString("txtSireCd.OutputFormat")
        Me.txtSireCd.Style = "font-family: MS ゴシック; font-size: 8pt; text-align: left; vertical-align: middle; w" &
    "hite-space: nowrap; ddo-char-set: 1; ddo-wrap-mode: nowrap"
        Me.txtSireCd.Text = "000000-000"
        Me.txtSireCd.Top = 0!
        Me.txtSireCd.Width = 0.584!
        '
        'SectionReport1
        '
        Me.MasterReport = False
        Me.PageSettings.DefaultPaperSize = False
        Me.PageSettings.Margins.Bottom = 0.4!
        Me.PageSettings.Margins.Left = 0.4!
        Me.PageSettings.Margins.Right = 0!
        Me.PageSettings.Margins.Top = 0.39!
        Me.PageSettings.Orientation = GrapeCity.ActiveReports.Document.Section.PageOrientation.Landscape
        Me.PageSettings.PaperHeight = 16.53543!
        Me.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A3
        Me.PageSettings.PaperWidth = 11.69291!
        Me.PrintWidth = 15.844!
        Me.Sections.Add(Me.ReportHeader1)
        Me.Sections.Add(Me.PageHeader)
        Me.Sections.Add(Me.Detail)
        Me.Sections.Add(Me.PageFooter)
        Me.Sections.Add(Me.ReportFooter1)
        Me.StyleSheet.Add(New DDCssLib.StyleSheetRule("font-style: normal; text-decoration: none; font-weight: normal; font-size: 10pt; " &
            "color: Black; font-family: ""MS UI Gothic""; ddo-char-set: 128", "Normal"))
        Me.StyleSheet.Add(New DDCssLib.StyleSheetRule("font-size: 16pt; font-weight: bold; font-family: ""MS UI Gothic""; ddo-char-set: 12" &
            "8", "Heading1", "Normal"))
        Me.StyleSheet.Add(New DDCssLib.StyleSheetRule("font-size: 14pt; font-weight: bold; font-style: inherit; font-family: ""MS UI Goth" &
            "ic""; ddo-char-set: 128", "Heading2", "Normal"))
        Me.StyleSheet.Add(New DDCssLib.StyleSheetRule("font-size: 13pt; font-weight: bold; ddo-char-set: 128", "Heading3", "Normal"))
        CType(Me.lblSireTanto, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.txtSireTantoCd, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.Label1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.txtSireCd, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me, System.ComponentModel.ISupportInitialize).EndInit()

    End Sub

    Private WithEvents lblSireTanto As GrapeCity.ActiveReports.SectionReportModel.Label
    Private WithEvents txtSireTantoCd As GrapeCity.ActiveReports.SectionReportModel.TextBox
    Private WithEvents Label1 As GrapeCity.ActiveReports.SectionReportModel.Label
    Private WithEvents txtSireCd As GrapeCity.ActiveReports.SectionReportModel.TextBox
    Private WithEvents ReportHeader1 As GrapeCity.ActiveReports.SectionReportModel.ReportHeader
    Private WithEvents ReportFooter1 As GrapeCity.ActiveReports.SectionReportModel.ReportFooter
End Class
回复 使用道具 举报
beitesting
中级会员   /  发表于:2018-3-20 13:54:20
7#
SectionReport1.resx
<?xml version="1.0" encoding="utf-8"?>
<root>
  <!--
    Microsoft ResX Schema
   
    Version 2.0
   
    The primary goals of this format is to allow a simple XML format
    that is mostly human readable. The generation and parsing of the
    various data types are done through the TypeConverter classes
    associated with the data types.
   
    Example:
   
    ... ado.net/XML headers & schema ...
    <resheader name="resmimetype">text/microsoft-resx</resheader>
    <resheader name="version">2.0</resheader>
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
        <value>[base64 mime encoded serialized .NET Framework object]</value>
    </data>
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
        <comment>This is a comment</comment>
    </data>
               
    There are any number of "resheader" rows that contain simple
    name/value pairs.
   
    Each data row contains a name, and value. The row also contains a
    type or mimetype. Type corresponds to a .NET class that support
    text/value conversion through the TypeConverter architecture.
    Classes that don't support this are serialized and stored with the
    mimetype set.
   
    The mimetype is used for serialized objects, and tells the
    ResXResourceReader how to depersist the object. This is currently not
    extensible. For a given mimetype the value must be set accordingly:
   
    Note - application/x-microsoft.net.object.binary.base64 is the format
    that the ResXResourceWriter will generate, however the reader can
    read any of the formats listed below.
   
    mimetype: application/x-microsoft.net.object.binary.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
            : and then encoded with base64 encoding.
   
    mimetype: application/x-microsoft.net.object.soap.base64
    value   : The object must be serialized with
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
            : and then encoded with base64 encoding.

    mimetype: application/x-microsoft.net.object.bytearray.base64
    value   : The object must be serialized into a byte array
            : using a System.ComponentModel.TypeConverter
            : and then encoded with base64 encoding.
    -->
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
    <xsd:element name="root" msdata:IsDataSet="true">
      <xsd:complexType>
        <xsd:choice maxOccurs="unbounded">
          <xsd:element name="metadata">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
              </xsd:sequence>
              <xsd:attribute name="name" use="required" type="xsd:string" />
              <xsd:attribute name="type" type="xsd:string" />
              <xsd:attribute name="mimetype" type="xsd:string" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="assembly">
            <xsd:complexType>
              <xsd:attribute name="alias" type="xsd:string" />
              <xsd:attribute name="name" type="xsd:string" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="data">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
              <xsd:attribute ref="xml:space" />
            </xsd:complexType>
          </xsd:element>
          <xsd:element name="resheader">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
              </xsd:sequence>
              <xsd:attribute name="name" type="xsd:string" use="required" />
            </xsd:complexType>
          </xsd:element>
        </xsd:choice>
      </xsd:complexType>
    </xsd:element>
  </xsd:schema>
  <resheader name="resmimetype">
    <value>text/microsoft-resx</value>
  </resheader>
  <resheader name="version">
    <value>2.0</value>
  </resheader>
  <resheader name="reader">
    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <resheader name="writer">
    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
  </resheader>
  <data name="txtSireTantoCd.OutputFormat" xml:space="preserve">
    <value>00000</value>
  </data>
  <data name="txtSireCd.OutputFormat" xml:space="preserve">
    <value>000000-000</value>
  </data>
  <data name="txtSireTantoCd.OutputFormat" xml:space="preserve">
    <value>00000</value>
  </data>
  <data name="txtSireCd.OutputFormat" xml:space="preserve">
    <value>000000-000</value>
  </data>
  <metadata name="$this.ScriptEditorPositionForUndo" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>0, 0</value>
  </metadata>
  <metadata name="$this.ScriptEditorPositionForRedo" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    <value>0, 0</value>
  </metadata>
</root>
回复 使用道具 举报
beitesting
中级会员   /  发表于:2018-3-20 13:54:53
8#
SectionReport1.vb:
Imports GrapeCity.ActiveReports
Imports GrapeCity.ActiveReports.Document

Public Class SectionReport1

End Class
回复 使用道具 举报
beitesting
中级会员   /  发表于:2018-3-20 14:57:18
9#
KearneyKang 发表于 2018-3-20 11:39
您好!
你现在的问题是翻页后,出现了数据不连续,自动加1了。
您的Boss_CD 和User_CD   是绑定的数据源 ...

不好意思啊,网络有限制,连图片也不让外传。
所以,只能把代码都发出来了。
回复 使用道具 举报
KearneyKang讲师达人认证 悬赏达人认证
超级版主   /  发表于:2018-3-20 16:51:20
10#
您用的是区域报表,但是您发这样的代码,我这边根本还原不了。
我这边尝试着还原,但是没还原出来。
回复 使用道具 举报
12下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部