Display image in report and Email option

mohanarajmohanaraj 600001
edited 9:32AM in FastReport .NET
Dear all,

How can i display image in the report for example i want to display the company logo in the report can you explain in detail with its steps.

And also i want to email the generated report how it possible?

Explain both please.


Thanks in advance.

Comments

  • edited 9:32AM
    Hello,

    Just put the PictureObject on your report page, invoke its editor and load the image in it.

    The email functionality is working in Windows.Forms now. I need to fix something to make it working in ASP.Net.
  • mohanarajmohanaraj 600001
    edited October 2009
    AlexTZ wrote on Oct 13 2009, 03:13 PM:
    Hello,

    Just put the PictureObject on your report page, invoke its editor and load the image in it.

    Dear AlexTZ,

    Thanks for your reply.

    I want to load the image present in the server path this server path is saved in the Database i only pass the image url from by ASP.Net application itself How can i do this.

    Please advice.

    Advance Thanks .
  • edited 9:32AM
    Set the PictureObject.ImageLocation property to either URL or file path.
  • mohanarajmohanaraj 600001
    edited October 2009
    AlexTZ wrote: »
    Set the PictureObject.ImageLocation property to either URL or file path.


    Dear AlexTZ,

    Thank you for the solution.

    Can you please fix the option for email this report.
  • edited 9:32AM
    Hello,

    It's not easy to fix; probably we will add this feature in the next major version.
  • mohanarajmohanaraj 600001
    edited 9:32AM
    AlexTZ wrote: »
    Hello,

    It's not easy to fix; probably we will add this feature in the next major version.



    Dear AlexTZ,

    It is possible to email the .pdf report without dispaly the report (only generate the .pdf) and save automatically in default path without prompt the user to save this .pdf file and send this file as email attachment. (Separately by using button click )

    How can we achieve.
  • edited 9:32AM
    To do this, you don't need WebReport component. You may write the following code in the button.Click handler:
    using (Report report = new Report())
    {
      report.Load(filename);
      report.RegisterData(...);
      report.Prepare();
    
      EmailExport email = new EmailExport();
      // set properties of email.Account here...
      // ...
    
      // the email
      email.Address = "john@url.com";
      email.Subject = "report for you";
      email.MessageBody = "Hi John!";
    
      // email the report as a PDF
      PDFExport pdfExport = new PDFExport();
      // you may set some options of pdfExport here...
      // ...
      email.Export = pdfExport;
    
      // send an email
      email.SendEmail(report);
    }
    
  • edited December 2010
    Hi AlexTZ

    i have an error generating a PDF and then sending it by email. That's what the page says:

    Source Error:

    Line 58: Dim ElPDFExport As PDFExport = New PDFExport
    Line 59: ElEMailExport.Export = ElPDFExport
    Line 60: ElEMailExport.SendEmail(ElReport)

    Source File: C:\Inetpub\wwwroot\proves\newcharter.aspx.vb Line: 60

    [ArgumentException: The parameter 'address' cannot be an empty string.
    Parameter name: address]
    System.Net.Mail.MailAddress..ctor(String address, String displayName, Encoding displayNameEncoding) +1496053
    FastReport.Export.Email.EmailExport.SendEmail(Report report) +341
    Newcharter.ImageButton1_Click(Object sender, ImageClickEventArgs e) in C:\Inetpub\wwwroot\proves\newcharter.aspx.vb:60
    System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +115
    System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +120
    System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

    The code is very similar at your post:
        Protected Sub ImageButton1_Click(............) Handles ImageButton1.Click
    
            Dim ElReport = New Report
    
            ElReport.Load(Server.MapPath("mail.frx"))
    
            Dim UnDataset = New System.Data.DataSet
            ElReport.RegisterData(UnDataset)
    
            REM ElReport.SetParameterValue("NMDbConnectionString", "Data Source=SERVER1\SQLEXPRESS;AttachDbFilename=;Initial Catalog=capdb;Integrated Security=True;Persist Security Info=False;User ID=;Password=")
            ElReport.Prepare()
    
            Dim ElEMailExport As EmailExport = New EmailExport
            ElEMailExport.Address = "xxx@xxxx.com"
            ElEMailExport.Subject = "ORDER "
            ElEMailExport.MessageBody = "ORDER
    
    Please take notice of the attached order.
    
    Kind Regards"
    
            Dim ElPDFExport As PDFExport = New PDFExport
            ElEMailExport.Export = ElPDFExport
    
            ElEMailExport.SendEmail(ElReport)
    

    I'm using Visual Studio 2010 with VB and FastReports.NET Demo 1.5.29 i'm evaluating it, in order to buy a license.

    Thanks in advance !

    Toni
    wrote: »
    To do this, you don't need WebReport component. You may write the following code in the button.Click handler:
    using (Report report = new Report())
    {
      report.Load(filename);
      report.RegisterData(...);
      report.Prepare();
    
      EmailExport email = new EmailExport();
      // set properties of email.Account here...
      // ...
    
      // the email
      email.Address = "john@url.com";
      email.Subject = "report for you";
      email.MessageBody = "Hi John!";
    
      // email the report as a PDF
      PDFExport pdfExport = new PDFExport();
      // you may set some options of pdfExport here...
      // ...
      email.Export = pdfExport;
    
      // send an email
      email.SendEmail(report);
    }
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.