Click here to Skip to main content
11,922,587 members (29,554 online)
Click here to Skip to main content
Add your own
alternative version


57 bookmarked

A Workaround to Customizing and Localizing the Microsoft ReportViewer .NET Toolbar

, 25 May 2006 CPOL
Rate this:
Please Sign up or sign in to vote.
An article about how to customize and localize the Microsoft ReportViewer Toolbar.

ReportViewer Toolbar


Microsoft released a new component called ReportViewer based on the new RDL technology. Since this is a new component, there are not enough samples about it. There are many questions about how to localize and customize the ReportViewer toolbar, in some forums. Some developers want to add a help button on it, some people want to localize it for Turkish etc.

What is RDL - Report Definition Language

A report definition contains data retrieval and layout information for a report. Report Definition Language (RDL) is an XML representation of this report definition. RDL is an open schema; developers can extend RDL with additional attributes and elements.

The standard file extension for report definition files is .rdl. Its MIME type is text/xml.

More resources about RDL


The best way to localize and customize the ReportViewer toolbar is to hide it and implement its methods in your own code. This article is simply based on this idea.

Using the code

You can simply hide the ReportViewer toolbar, like this:

repView.ShowToolBar = false;

This will completely hide the ReportViewer toolbar. Then add your own toolstrip and implement the necessary methods.

To find a string in the report:

private bool frmCmdFind()
    int found = this.repView.Find(txtSearch.Text, 1);
    if (found > 0)
        btnFindNext.Enabled = true;
        MessageBox.Show("Searched string not found", 
                        "Info", MessageBoxButtons.OK, 
        btnFindNext.Enabled = false;
    return true;

To exporting a report as an Adobe Acrobat PDF file:

private bool frmCmdPdf()
    LocalReport lr = this.repView.LocalReport;
    lr.ReportPath = this.repView.LocalReport.ReportPath;
    string outputFile = this.ReportDisplayName + ".pdf";
    Warning[] warnings;
    string[] streamids;
    string mimeType = "";
    string encoding = "";
    string extension = "";

    deviceInfo = "";

    byte[] bytes = lr.Render("PDF", deviceInfo, out mimeType, 
                             out encoding, out extension, 
                             out streamids, out warnings);

    FileStream fs = new FileStream(outputFile, FileMode.Create);
    fs.Write(bytes, 0, bytes.Length);
    System.Diagnostics.Process p = new System.Diagnostics.Process();
    p = new System.Diagnostics.Process();

    p.StartInfo.FileName = outputFile;
    return true;

For full implementation, see the source file above.


Microsoft ReportViewer is a powerful component to display your report, and RDL is a good way to implement the reporting features. I believe that in the near future, many RDL designer tools and RDL viewer tools will be available in the market.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) MikroKom Yazilim A.S.
Turkey Turkey
c# , vb6 , mssql , oracle , mysql , asp , developer.

You may also be interested in...

Comments and Discussions

QuestionCustomizing and Localizing the Microsoft ReportViewer .NET Toolbar web form Pin
dbongs28-Feb-14 0:21
memberdbongs28-Feb-14 0:21 
GeneralSimply way to customize report ToolBar Pin
general.jesiu5-Nov-09 9:42
membergeneral.jesiu5-Nov-09 9:42 
GeneralThanks, Pin
S. Töpfer28-Sep-09 23:20
memberS. Töpfer28-Sep-09 23:20 
GeneralRe: Thanks, Pin
yincekara29-Sep-09 2:09
memberyincekara29-Sep-09 2:09 
QuestionHow to invoke the pagesteup dialog box programatically Pin
Member 429011810-Apr-08 7:57
memberMember 429011810-Apr-08 7:57 
AnswerRe: How to invoke the pagesteup dialog box programatically Pin
yincekara29-Sep-09 2:23
memberyincekara29-Sep-09 2:23 
Generalcode licence Pin
marsu3622-Dec-07 23:29
membermarsu3622-Dec-07 23:29 
GeneralRe: code licence Pin
yincekara14-May-08 23:11
memberyincekara14-May-08 23:11 
GeneralRefreshing the Report Bounds Pin
f r i s c h13-Sep-07 4:17
memberf r i s c h13-Sep-07 4:17 
Hello there, nice article i must say.

Unfortunately i have another issue for you. After changing the margin-values via PageSetup i can not see any change until i have restarted my Application or at least show the same report in a newly created control.

I guess thats because the control doesnt reload the report definitions probably.

I have already tried setting the LocalReport.ReportPath again and also reportViewer.RefreshReport but without any success.

May i have an advice from you please.

Thank you.
GeneralRe: Refreshing the Report Bounds Pin
yincekara13-Sep-07 4:32
memberyincekara13-Sep-07 4:32 
GeneralRe: Refreshing the Report Bounds Pin
f r i s c h13-Sep-07 22:33
memberf r i s c h13-Sep-07 22:33 
GeneralRe: Refreshing the Report Bounds Pin
yincekara13-Sep-07 22:58
memberyincekara13-Sep-07 22:58 
Generalshowing report in report viewer without using smart tags Pin
MeSiddy16-Aug-07 7:37
memberMeSiddy16-Aug-07 7:37 
GeneralRe: showing report in report viewer without using smart tags Pin
yincekara16-Aug-07 8:50
memberyincekara16-Aug-07 8:50 
QuestionReportviewer Help Pin
abraylyan11-Mar-07 16:00
memberabraylyan11-Mar-07 16:00 
AnswerRe: Reportviewer Help Pin
yincekara11-Mar-07 22:47
memberyincekara11-Mar-07 22:47 
GeneralReportViewer problem Pin
Kschuler29-Jan-07 9:31
memberKschuler29-Jan-07 9:31 
GeneralRe: ReportViewer problem Pin
polymorphism8-Feb-07 3:32
memberpolymorphism8-Feb-07 3:32 
GeneralRe: ReportViewer problem Pin
Kschuler9-Feb-07 3:54
memberKschuler9-Feb-07 3:54 
GeneralRe: ReportViewer problem Pin
Aeroday19-Jul-07 7:16
memberAeroday19-Jul-07 7:16 
GeneralTurkish language Pin
Maksi20-Nov-06 23:25
memberMaksi20-Nov-06 23:25 
GeneralRe: Turkish language Pin
yincekara20-Nov-06 23:58
memberyincekara20-Nov-06 23:58 
GeneralRe: Turkish language [modified] Pin
yincekara12-Feb-07 1:03
memberyincekara12-Feb-07 1:03 
Generallocalization [modified] Pin
lemravec14-Aug-06 9:16
memberlemravec14-Aug-06 9:16 
GeneralRe: localization Pin
polymorphism21-Aug-06 0:26
memberpolymorphism21-Aug-06 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.151125.1 | Last Updated 25 May 2006
Article Copyright 2006 by yincekara
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid