Working with a table

I have a table with two rows, so that the first row (row0) is being used for "headers" and second row (row1) for data. Can I somehow tell FastReports to only print row0 (the headers) once and wait for all the other data from row1 to be printed, before the next headers will be printed again? I have tried to use Table1_ManualBuild but haven't figured it out how to get this done.

An example would be like this:

Monday 9.8.2021 (GroupHeader)

TABLE ROW0 HERE SCHEME

TABLE ROW1 DATA WORK

TABLE ROW1 DATA LUNCH

TABLE ROW1 DATA HOME


Tuesday 10.8.2021 (GroupHeader)

TABLE ROW0 HERE SCHEME

TABLE ROW1 DATA WORK

TABLE ROW1 DATA LUNCH

TABLE ROW1 DATA HOME

So my table is inside the Data1 so that it's possible to use groupheaders for WeekOfYear and DayOfWeek.

Comments

  • In the Manual Build Event you will need something like this:

     private void ManualBuildTable(object sender, EventArgs e)
    {
      TableObject myTable = (TableObject)sender;
      DataSourceBase myData = Report.GetDataSource("MyDataSource"); //do this for each data source you need to reference
      myData.Init(); //This tells the data to start at the first row.
      
      // Keep adding to your table, until all the data has been written.
      while (myData.HasMoreRows)
      {
        // Let's write the table's header
        myTable.PrintRow(0); //Prepares the first row of your table template
        myTable.PrintColumns(); // Prints all the columns in the prepared row.
      
        // Now let's write our data. Here I assume your data is all in one source in the right order.
        // Row 1: Data Work
        // Row 2: Data Lunch
        // Row 3: Data Home
        for ( int i = 0; i < 3; i++)
        {
          myTable.PrintRow(1);
          myTable.PrintColumns();
          myData.Next(); // Tell the data source to look at the next row.
        }
      } 
    }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.