This is a migrated thread and some comments may be shown as answers.

How to set document name when printing in Telerik Report

7 Answers 1022 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
vijay
Top achievements
Rank 1
vijay asked on 31 Mar 2017, 08:09 AM

I have designed a Telerik report, when printing the report from report viewer, its taking some unique id on the print queue.

How do I document name when printing in Telerik Report viewer.
I found this link when googling,

 http://docs.telerik.com/reporting/m-telerik-reporting-processing-reportprocessor-printreport
but i dont know when it will be called ? where to use this?

7 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 31 Mar 2017, 02:55 PM
Hello vijay,

The name of the produced document is set based on the report's DocumentName property that can be set on designing the report.

I hope this helps.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tanveer
Top achievements
Rank 1
answered on 28 Jul 2020, 11:32 AM

Trying to set the report name in a blazor project.
Tried the binding the documentname property to a parameter and then to a field.

When i download/export the file from viewer it still shows the name of the report instead as name of exported file. How can i set the name of the document in blazor?

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 30 Jul 2020, 06:34 PM

Hi Tanveer,

I just wanted to give you a heads up that this was answered in your support ticket 1478236. However, I will add the response here for anyone looking for a sample in the community as well. 

Setting the Document Name on Export or Print

This is dependent upon the DocumentName property and the best approach to bind this to a Report Parameter. Let me go over how to do this below. 

Binding the DocumentName

In the Report Definition file, create a Report Parameter and bind its value to the DocumentName. See the screenshots below for a visual reference.

Note that previewing the report and exporting it in the Report Designer will always refer to the file name and not the Report Parameter value.

The Report Parameter Properties

Note that the Visibility and AutoRefresh properties are set to true. This will enable the end-users to edit the parameter and the report will refresh.

The DocumentName Property

Pass the Parameter to the Report

To pass parameters from the Blazor Report Viewer to the Report use the @code syntax. See the following Blazor Report Viewer markup for an example.

Note that the below code snippet is related to our Blazor Report Viewer. Although, each of our Report Viewer's have the same capability. See the Report Viewers Overview for a reference of our Report Viewers.

<ReportViewer @ref="reportViewer1"
              ViewerId="rv1"
              ServiceUrl="/api/reports"
              ReportSource="@(new ReportSourceOptions()
                              {
                                  Report = "SampleReport.trdp",
                                  Parameters = new Dictionary<string, object>
                                  {
                                      { "ReportName", ReportName },
                                      { "Date", date }
                                  }
                              })"
              Parameters="@(new ParametersOptions { Editors = new EditorsOptions { MultiSelect = EditorType.ComboBox, SingleSelect = EditorType.ComboBox } })"
              ScaleMode="@(ScaleMode.Specific)"
              Scale="1.0" />

@code {
    ReportViewer reportViewer1;
    string ReportName = "AName";
    DateTime date = DateTime.Now;
}

Wrapping Up

For additional reference, I have attached a sample project that illustrates changing the name of the Exported Document. To use the sample, ensure the Telerik NuGet Feed is Configured in Visual Studio.

Please let me know if you need any additional information. Thank you for choosing Telerik Reporting.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

0
AQEEL KHAN
Top achievements
Rank 1
Veteran
answered on 11 Aug 2020, 01:02 AM

Eric R First of all thank you for your detail explanation which help me a lot.  now only one question i have what about store procedure parameter ? the example you have provided is working perfectly for Report Parameter but store procedure parameter is not working can you help please i have 20 days left for my trail?

 

AQEEL

0
AQEEL KHAN
Top achievements
Rank 1
Veteran
answered on 11 Aug 2020, 01:17 AM

I am not sure if this is good practice but here what i did.

.1 i have created report parameter.

.2 open the connection property 

.3 expand the parameters (all these parameter name is from my store procedure)

.4 select parameter example in my case PlanID

.5 on value i have assign this to report parameter.

 

AQEEL

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 11 Aug 2020, 08:22 PM

Hi Aqeel,

This thread is related to changing the Document Name when Printing. I only used the parameter as a means to change the document name dynamically. 

For your requirement, I recommend reviewing the article for Connecting to a SQL Server Database using a Stored Procedure

Additionally, see the Using Parameters with the SqlDataSource Component documentation for the configuring the Parameter.

Note that using the SqlDataSource Wizard will guide you in configuring parameters and the Stored Procedure.

If you have any questions relating to these I ask that you please create a new thread so that we can keep the topics organized.

Thank you for using the Telerik Reporting forums. 

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

0
GodHank
Top achievements
Rank 1
answered on 13 Aug 2020, 08:47 AM
Thank you all for your kindness to me, I wish you good health and good luck!
Tags
General Discussions
Asked by
vijay
Top achievements
Rank 1
Answers by
Stef
Telerik team
Tanveer
Top achievements
Rank 1
Eric R | Senior Technical Support Engineer
Telerik team
AQEEL KHAN
Top achievements
Rank 1
Veteran
GodHank
Top achievements
Rank 1
Share this question
or