FastReport.net enables printing corresponding data per line

Source: Internet
Author: User

This article from: http://www.cnblogs.com/msdn/archive/2009/06/26/1511764.html

 

Company in FastReport. net version is coming out soon, let us learn, because the company's software requires the use of this tool, some of which require the data area to display N pieces of data per line, I will not, ah, I asked the experts and came to the conclusion that FastReport could not be achieved. At that time, I thought so, because they were experts. Therefore, any program that has similar requirements can only be processed as a field in the cs code. concatenate a string and wrap the line in the middle of the carriage return.

Today, I had a hard time idle. I thought about whether it could be implemented. So I started to do it. Oh, I finally realized it. The code may be simple, but I was born out of nothing, happy to say.

1. First, pull a Table control from the toolbar, place the data to be displayed in the corresponding cell, and set the Table1 control attribute LayOut to Wrapped.

2. Generate events

 

 

 

Code
Using System;
Using System. Collections;
Using System. Collections. Generic;
Using System. ComponentModel;
Using System. Windows. Forms;
Using System. Drawing;
Using System. Data;
Using FastReport;
Using FastReport. Data;
Using FastReport. Dialog;
Using FastReport. Barcode;
Using FastReport. Table;
Using FastReport. Utils;

Namespace FastReport
{
Public class ReportScript
{
Private void tablew.beforeprint (object sender, EventArgs e)
{

// Get the data source by its name
Performancebase columnData = Report. GetDataSource ("Employees ");
// Init the data source
ColumnData. Init ();

While (columnData. HasMoreRows)
{

If (columnData. CurrentRowNo) % 2 = 0)
{
Table1.PageBreak ();
}
// Print the table body
Table1.PrintColumn (0 );
Table1.PrintRows ();


// Go next data source row
ColumnData. Next ();
}

}
 
}
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.