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

How to change the default PDF filename?

15 Answers 1271 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Feedback
Top achievements
Rank 1
Feedback asked on 08 Aug 2007, 07:40 AM
When a user clicks on the "Export" button of the ReportViewer, he or she can choose to export the report to a PDF file because I made sure to reference the ImageRendering dll in my project.

How can I change the default filename to which the report will be exported?  I need to change this at run time, based on which report they have run and on which products.

Is there a way to set this?  Right now, it always exports to "Report.pdf" and that isn't going to work for this project.

I looked in the documentation, and in this forum, and have come up empty for setting the filename when the ReportViewer is being used (direct export to PDF is covered quite nicely here in the forum, however.)

Thanks!

15 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 08 Aug 2007, 12:38 PM
Thank you for the nice question, Matthew.

The default name of the file, when exporting a report, is the name of the report class plus the appropriate extension. As of now, there is not way to override that name at runtime. You can create different report classes with different names that inherit from your original report, and each of them will be exported with its appropriate name.

We will consider adding this functionality in a future version. There is no workaround I can suggest at the present moment.
 

Best wishes,
Rossen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Joel
Top achievements
Rank 2
answered on 24 Sep 2007, 08:15 PM
I was curious if the ability to programatically name the pdf file has been added in the Q2 release?  Our standard class naming convention makes for a very odd user experience.  This would be important functionality in the future if it does not exist yet.
0
Svetoslav
Telerik team
answered on 25 Sep 2007, 09:10 AM
Hi Joel,

To our great regret we didn't got enough time and postponed the feature for the next version, due at the end of the year. Sorry for the delay.
 
 
Kind regards,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Gary C
Top achievements
Rank 1
answered on 10 Oct 2009, 12:09 AM
Hello,

Has this feature has been implemented in the latest version? (i.e. changing the export file name at runtime). If so, how do you do it?

Thanks,
-Gary
0
Steve
Telerik team
answered on 12 Oct 2009, 10:56 AM
Hello Gary,

You should use the DocumentName property of the report for this purpose.

Best wishes,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Brajalal
Top achievements
Rank 1
Iron
commented on 06 Nov 2023, 12:42 PM

Hi,

As you suggested, the DocumentName property not working I am using Version  17.023.118 in Telerik reporting designer. 

Todor
Telerik team
commented on 07 Nov 2023, 03:24 PM

Hi Brajalal,

Indeed, when you export from the Standalone Report Designer, the default name of the document is the Name of the Report.

The DocumentName is used when you export from the viewers.

0
Dan
Top achievements
Rank 1
answered on 28 Feb 2013, 06:23 PM
This question is a few years old now.  Is there a solution for this yet?  I just had a customer request the file be named to something other than the class name.
0
Squall
Top achievements
Rank 1
answered on 01 Mar 2013, 02:59 PM
Have you tried to set the Report.DocumentName property?
0
Dan
Top achievements
Rank 1
answered on 01 Mar 2013, 03:15 PM
Yes.  About 2 minutes after I posted this I found another thread which described how to do this.
0
Andrew
Top achievements
Rank 1
answered on 27 Aug 2019, 03:23 PM

Hello,

I know this post is quite old, but this is still not working for me. I tried setting Report.DocumentName from C# but export still saves the file using the class name in my report. I'm changing Report.DocumentName inside the Report_ReportNeedDataSourceEvent. Should that work fine?

I'm using Telerik Reports version 13.1.19.618 (runtime version v4.0.30319)

Thanks!

0
Andrew
Top achievements
Rank 1
answered on 27 Aug 2019, 06:41 PM
Quick update. I'm still not able to change Report.DocumentName from C#, but I did so in the report designer -> Properties -> Settings -> DocumentName by building an expression like: ='SpendingSummary_by' + IIf(Len(Parameters.PersonID.Value) > 0, 'Person', 'Product')
0
Neli
Telerik team
answered on 30 Aug 2019, 09:50 AM

Hello Andrew,

The approach you have found is the recommended one.
Basically, we advise avoiding modifying reports' structures in events. You should be able to set the DocumentName property in the NeedDataSource event. For more details, please check Changes on items in report events are not applied and Modifying or Creating a report at Run-Time KB articles

Regards,

 
Neli

Progress Telerik

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
Andrew
Top achievements
Rank 1
answered on 30 Aug 2019, 12:15 PM
Hi Neli, okay, thank you for confirming.
0
Joel
Top achievements
Rank 2
answered on 30 Aug 2019, 12:28 PM

Andrew, 

Here's the vb code we use.  It works.  We make a reportbook since sometimes we add cover pages or additional reports and set the filename there.  If you only have a single report you can ignore the first IF statement.  Hope it helps

 

    If _CoverType > 0 Then
        Select Case RepType
            Case 5, 22, 27, 30, 34, 36, 38, 42, 43, 46, 70  ' portrait
                CoverPage = New Reporting.CoverPage(_dtc, stitle, bmp)
            Case Else
                CoverPage = New Reporting.CoverPageLandscape(_dtc, stitle, bmp)
        End Select
    End If
 
    Dim repbook As New Telerik.Reporting.ReportBook
    If _CoverType > 0 Then
        repbook.Reports.Add(CoverPage)
    End If
    repbook.DocumentName = "MyPDFFileName"   '<---This is your PDF file name
    repbook.Reports.Add(thereport)
    thereport.DocumentName = repname
    myreport.Report = repbook ' thereport
End If
0
Andrew
Top achievements
Rank 1
answered on 30 Aug 2019, 08:10 PM
Joel, thanks for sharing that. Unfortunately I'm just working with standalone reports and not creating them within a ReportBook, but good to know that is an option.
0
Neli
Telerik team
answered on 02 Sep 2019, 12:35 PM

Hello Andrew,

When you set the DocumentName property, the value is not used when exporting from the Standalone report designer. The report filename will be used instead. However, if you integrate the report in some of the report viewers then the value of the property will be taken into account and the report will be saved with the new name. 

Regards,
Neli
Progress Telerik

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
Tags
General Discussions
Asked by
Feedback
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Joel
Top achievements
Rank 2
Svetoslav
Telerik team
Gary C
Top achievements
Rank 1
Steve
Telerik team
Dan
Top achievements
Rank 1
Squall
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Neli
Telerik team
Share this question
or