开发者

How to show headers in each page of the report in Microsoft Report Viewer

I am trying to create some reports, and I want to show the headers in each page of the reports. I create a table and the uppermost row becomes my header, but it is only shown for the first page of the report.

The only thin开发者_JS百科g that can be seen in each page are page headers and page footers, but these parts do not allow a table inside them. All I can use for my work on a page header is a textbox.

I tried to write my headers into some texboxes and put them side by side, but then the report data drifts from the headers' bounds.

How do I fix this problem?


In your .rdlc report there is small down arrow at the bottom right corner with red box, you need to click on “Advanced Mode”.

How to show headers in each page of the report in Microsoft Report Viewer

By clicking, your row and column groups will expand with new fields named “Static” as shown below:

How to show headers in each page of the report in Microsoft Report Viewer

Now, click “Static” in Row Groups list, and check the properties on the right side: Set “RepeatOnNewPage” to “True” and “KeepWithGroup” to “After” as shown below:

How to show headers in each page of the report in Microsoft Report Viewer

Now, repeat above procedure for all “Static” rows in Row Groups list, except the “Static” rows present under the different group (encircled with black color in following figure), do same for the Details group (encircled with red color):

How to show headers in each page of the report in Microsoft Report Viewer

This enables you to view Header Row on each page of .rdlc report.


How to show headers in each page of the report in Microsoft Report Viewer

In Row Groups below the main page of the report, there is a line "Static" writing on it. It is a tablix member and to repeat the headers use below attributes

RepeatOnNewPage = True and KeepWithGroup = After


When you select table header row and see its properties it has property called RepeatOnNewPage set it to true and table header will repeat on every new row.


This post gives a brief explanation on how to repeat header rows on each page in Reportviewer: http://blog.teamgrowth.net/index.php/net/how-to-repeat-header-rows-on-each-page-in-reportviewer-rdlc

Hope it will help!!

Cheers!! :)


I am creating a dynamic table - report. I can not group the rows. When I export the XML file to PDF, I'm writing

//......
string deviceInfo =
" <OutputFormat>PDF</OutputFormat>" +
" <PageWidth>11in</PageWidth>" +
" <PageHeight>8.5.0in</PageHeight>" +
" <MarginTop>0.05in</MarginTop>" +
" <MarginLeft>0.05in</MarginLeft>" +
" <MarginRight>0.05in</MarginRight>" +
" <MarginBottom>0.05in</MarginBottom>" +

" <KeepWithGroup>After</KeepWithGroup>" +
" <RepeatOnNewPage>true</RepeatOnNewPage>" + 
" <FixedData>true</FixedData>"+
" <RepeatHeaderOnNewPage>true</RepeatHeaderOnNewPage>" +
"</DeviceInfo>"; 
try
{
byte[] bytes = reportViewer1.LocalReport.Render(
"PDF", deviceInfo, out mimeType, out encoding, out filenameExtension,   //horizontal page
out streamids, out warnings);
using (FileStream fs = new FileStream(filename, FileMode.Create))
{
fs.Write(bytes, 0, bytes.Length);
fs.Close();
}
 return filename;
}
//....

, but the title can only see on a 1 page. What should I write in order to see the header on each page?


follwing solution work for me..when you have just single group data in your rdlc file.for multiple group data on file it wont

To repeat columns with row headers in a row group area

1.In Design view, right-click the corner handle for a selected tablix data region, and then click Tablix Properties.

2.On the General tab, under Row Headers, select Repeat header rows on each page.

3.Click OK.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜