none
LocalReport Render To PDF, modify Title of PDF RRS feed

  • Question

  • Hi,

    I export a LocalReport to a PDF file, I use the LocalReport.Render(...) method, but the title of PDF is the file name of the LocalReport.

    If the LocalReport file is "Sample.rdlc", the title of PDF will be "Sample".

    I want to define the title dynamically.

    Thanks an advance...

    Friday, April 23, 2010 1:47 PM

Answers

  • The title of PDF file is same to the file name of report (.rdlc).

    To define Title, we must load report definition and modify the property "ReportEmbeddedResource", this property is not evaluate if the report definition is already loaded.

    LocalReport myReport = new LocalReport();
    myReport.ReportEmbeddedResource = "Namespace.Sample.rdlc";
    
    Stream resourceReportStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(myReport.ReportEmbeddedResource);
    string resourceReportName = string.Empty;
    
    myReport.LoadReportDefinition(resourceReportStream);
    
    resourceReportName = myReport.ReportEmbeddedResource;
    
    myReport.ReportEmbeddedResource = "Sample Title";
    
    myReport.Render(...);
    
    myReport.ReportEmbeddedResource = resourceReportName;

    I do the  question and answer, why post ...

    • Marked as answer by Atmeitsatme Tuesday, April 27, 2010 3:04 PM
    Tuesday, April 27, 2010 3:04 PM