Skip to content

How to print the header after the table is paged? #272

@jonny-xhl

Description

@jonny-xhl

The test data

CREATE TABLE TestTable(
    ID int,
    SDate datetime
)

INSERT INTO TestTable
VALUES (1,GETDATE())
    ,(1,GETDATE())
    ,(1,GETDATE())

Notice:Add more than 20 lines to the test.

Add Data Source

Add data source with the TestTable.

The report design

The table ManualBuildEvent

public class ReportScript
  {
    private void TableTest_ManualBuild(object sender, EventArgs e)
    {
      DataSourceBase data1 = Report.GetDataSource("TestTable"); 
      data1.Init(); 
      TableTest.PrintRow(0);
      TableTest.PrintColumns();   
      while(data1.HasMoreRows)
      {
        TableTest.PrintRow(1);
        TableTest.PrintColumns();
        data1.Next();
      }
    }
  }

The result

I want the text on the table to be printed after paging when there is a lot of data, and the header of the table to be printed after paging.

One of my solutions solves the problem of printing table headers after paging:

     while(data1.HasMoreRows)
      {
        if (data1.CurrentRowNo!=0 && data1.CurrentRowNo%20==0)
        {
          TableTest.PrintRow(0);
          TableTest.PrintColumns();
        }
        TableTest.PrintRow(1);
        TableTest.PrintColumns();
        data1.Next();
      }

But you need to know exactly how many rows of data are on each page of the table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions