Export to email

Posted by: andersjonsson on 3 August 2017, 6:01 am EST

  • Posted 3 August 2017, 6:01 am EST

    Hi,

    We're using ActiveReports .NET atm but are considering to use Data Dynamics Reports instead.. However, we have one issue left to investigate. We have written a custom export filter for activereports that renders report-html to an email-message, with embedded images. Now Im looking to try and do the same for Data Dynamics Reports..
    This means that I need to find all images so I can embed them and replace their url:s. Is there any easy way to accomplish this? Like IOutputHtml in ActiveReports .NET?
  • Replied 3 August 2017, 6:01 am EST

    I've tried using the mht-output, and did actually succeed in mailing the report, but the result left a little to be desired. The output includes css-classes that doesnt work too well with outlook2007.. Is there any way to make the HTML Rendering Extension put all styles inline? I was hoping that Fragment=True would accomplish this, but it doesnt seem like it.

    I took a quick look at StreamProvider and RenderingExtension but didnt get a real "feel" for how it works. Do you have any example code I could take a look at?

    Another quick question. Is it possible to disable parts of the webviewer? We're not interested in the built-in mail function and would like to hide it.
  • Replied 3 August 2017, 6:01 am EST

    You can use the HTML Rendering Extension in Data Dynamics Reports to save the output as an .mht file which is actually a MIME encoded file (which is exactly how HTML emails are encoded). You might consider grabbing that .mht output from the rendering extension and trying to use it as the content/body of the email. For more information see the following link (note the MhtOutput option):
    http://www.datadynamics.com/Help/ddReports/ddrconHTML.html

    However, there is something very similar to IOutputHtml in ActiveReports in Data Dynamics Reports. In DDReports it is called a StreamProvider. It is a class you can pass into the Render method of the rendering extensions and the rendering extensions will refer back to the StreamProvider to get the streams that it will write to the report. It is a little on the complicated side, but it is very powerful. If you need a hand with it let us know. For more information about StreamProvider see the following links:
    Scott Willeke
    Data Dynamics / GrapeCity


  • Replied 3 August 2017, 6:01 am EST

    Any progress on the outlook-front?

    Also, I'd still like to see some examples of working with StreamProvider and RenderingExtension, if you have any, so I can see about writing my own mail-export filter.
    I did get the MhtOutput to work but had to extract it and use another component to pack the resulting files into a mail that would be accepted by the mail clients.
  • Replied 3 August 2017, 6:01 am EST

    One of the DDR team members pointed me to the following forum thread: http://www.datadynamics.com/forums/110871/ShowPost.aspx

    This thread actually includes a workaround that enables you to hide or disable the toolbar of the webviewer. Unfortunately, it is a bit of a hack and not an ideal solution, but if it is important for your needs you should be able to use it. Also, we have case 40678 open internally to allow a way to completely customize the toolbar of the webviewer. Since you have reported it again I've asked the PM to consider pushing this one near the top of their priority list. Hopefully he will and well see a new convenient way to customize the toolbar soon!

    Scott Willeke
    Data Dynamics / GrapeCity
  • Replied 3 August 2017, 6:01 am EST

    I have entered a case on your behalf to have us do some checking into what will work with outlook and make it work "out of the box" for outlook. The case number is 128713.  I don't know of way to force the styles to be inline, but if that is a good solution when they text with Outlook here we should be able to turnaround a good solution for you quickly.

    I don't see a way to customize the toolbar. Let me ask around about that and have someone else jump in here if there is a way...

    Scott Willeke
    Data Dynamics / GrapeCity
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    I have increased the priority of the email-export change request and I will start working on this tomorrow..Once this feature is implemented and the build to release is prepared you will be notified about that.

    See this thread for the example of StreamProvider implementation.
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    I have tested the emailing of the multi-page report..To get the correct output in outlook I have set Pagination="off" for WordRE, here is the snippet of the code:
                WordRenderingExtension renderer = new WordRenderingExtension();
                NameValueCollection settings = (renderer as IConfigurable).GetSupportedSettings().GetSettings();
                settings["Pagination"] = "off";
                MemoryStreamProvider provider = new MemoryStreamProvider();
                runtime.Render(renderer, provider, settings);

    If it does not work for you, could you please send me RDLX file of the report which causes the problem?

    Then, regarding the inline styles..Currently our product does not expose the way that allows to get html-inline-styles output. Actually I would search for open-source-code solution that converts css style to inline one or even implement such a functionality myself. This should not be difficult - searhing of internal css styles and replacing the class names/id's with style attribute would be performed by using regular expressions.
    However, we will consider adding inline styles feature in HTML Rendering Extension, I just can't give you any estimates when this feature will be released.
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    Hello Sergey,

    Thank you for the sample. It was really helpful.

    There is, however, still problems with the word-output. Our report is multi-page and for some reason only the last page is shown (one of the columns seems to have all the pages stacked on top of each other though). See the attached screenshot.
    When I set Pagination = "off" the result looks like the report, but only shows the first page. Are there any more settings I need to change?

    One more thing: I tried rendering word-output to one alternateview and html to another. That worked well for outlook and thunderbird (outlook chose the one from word, and thunderbird chose html). The only problem here is that there are many email clients that doesnt accept css classes (gmail for instance) so the resulting table is not shown correctly. Do you have any suggestions for making the styles render inline? Im sure there are components available that will remove the css-classes and place the styles inline, but if possible I'd prefer not to hook in more components than necessary.

    Let me finish by saying that I really appreciate all your help with this issue


  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    I have realized that .NET Smtp API does not support sending emails that are in MHTML format. In this thread  they suggested to use html format + linked resources to send html email that includes the images.
    I have created small sample that renders DDR report that has the image to Word Html format and sends email using .NET smtp client. Some notes about the sample:
    * The report uses AdwntureWorks database, change the connection string to speciffy the SQL server instance.
    * I used local smtp server to send emails, change it if needed.

    </font></font>
    2009/04/SendEmail.zip
  • Replied 3 August 2017, 6:01 am EST

    Hello Sergey,

    I tried, but for some reason I can't manage to send the Mht file so that it displays correctly. The only way I have gotten it to work is by unpacking the mht and then repacking it again, but in doing that, all word-specific formatting vanished, so that is no good..

    Could you post an example where you send a mail from an mht file programmatically?
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    I performed some research regarding HTML rendering in Outlook 2007 and found this article. So, they changed the rendering engine from IE to Word 2007...DDR Word Rendering Extension renders the reports to "Word Html" format which ideally suitable for Outlook 2007..At least I tested it a bit and all the elements/styles of a report which is rendered to Word are shown perfectly by Outlook 2007.
    Could you please test it and let us know whether it works for you? Word Rendering Extension also supports Mht rendering which can be used to keep the images inside the document..
    Then..I understand that you would like to send emails that can be read in any e-mail client..I suppose that you send emails programmatically. So, to send email that can be rendered properly in Outlook 2007 <i>and  </i>other email clients, you can use alternate views feature of .NET Smtp Client. The main view of the email can be presented in html(HTML RE rendered) format and the alternate view can be presented in Word(Word RE rendered) format.

    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    <font size="2"><font face="Tahoma">Hello,
    The inline styles mode of Html RE is implemented and we are testing it.
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    Hello Sergey,

    Any news on this issue?
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hi,
    We are discussing the approach that we will implement in order to support the output that is compatible with outlook, gmail and other clients. I will return with more details soon.
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    Hello Sergey,

    Ah, then it's back to square one I guess...

    Will do a couple of attempts with the ordinary html in outlook to see how it looks with inline styles..

    Btw, are there any plans for a html output similar to ActiveReports "Legacy"?

    Thank you for the answers
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    Sorry for the delayed reply.
    Regarding the "partial output" problem - It is MS Word limitation that the page height can not be more than 22 inches. It can be observed by opening email.doc you have sent, then going to Page Setup. You can see that the page height is set to 22", however it is 60" in the document..
    This is why we disabled Pagination option for Word RE settings(if you export report from Viewer control).

    Regarding the "weird output" problem - it takes some time to simulate the data for the report to get the output, I will return with more details later.

    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    Hello Sergey,

    I did some more tests, and with pagination off it does render everything, but for some reason only part of the document is shown (both in outlook and in word). I've looked at the source and the entire document is there.

    I've attached a zip file with the rdlx-file (DdReport.rdlx) and a rendered version (I named it .doc, but it's just the word html)

    I also attached another rdlx-file Demo_Invoice.rdlx that also results in a weird output.. It might be a flaw in our report design, but I'd really appreciate if you could take a look.

    Due to our company policy I can't include the data but Im sure the effect will be the same no matter what data is displayed

    Ok, I will look for a way to convert the styles in an extra step. As you say it should not be difficult.



    2009/04/DdReport.zip
  • Replied 3 August 2017, 6:01 am EST

    Something about this week has brought a lot of requests wanting to know what the status of this feature is; rather than reply to everyone privately I'm going to post the status update here.

    First some background, our previous attempts at solving this issue all revolved around taking the current HTML rendering extension and try to get it to output HTML that was acceptable to various email clients.  This worked for in some cases, but not in various email clients we want to target.  We tried this several times but it has become apparent that the right way to do this is to treat Email as a first class citizen.

    To that end, we are creating a new rendering extension, the purpose of which will be to create output that is suitable for being emailed.  That entails: MIME encoded images, using inline styles where appropriate, a table based layout, etc.  At this time we are focusing our efforts on ensuring emails render well in Outlook 2003, Outlook 2007, and Gmail.  The team is wrapping up the rendering aspect and next we will focus on the API that will be used to generate the emails.  My goal with the API is to make it as simple as possible for the developer to use, what I'd like to do is have the dev. pass in a new MailMessage and have the new rendering extension add the content.

    James
  • Replied 3 August 2017, 6:01 am EST

    <font face="Arial" size="1">Hi Sergey

    As you might know, this is the last and most important feature we need before converting from AR.Net.
    You guys have soloved our other issues, which we are much grateful for and this (among other things) makes us eager to covert!

    Have you been able to release a build with a working solution to this issue?</font>
  • Replied 3 August 2017, 6:01 am EST

    <font size="2"><font face="Tahoma">Please, ignore my previous message. I am preparing the build for you and will provide you with the details shortly.</font></font><span id="BugEvents"><font size="2" face="Tahoma"></font>
    </span>
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Well, let me try again. You can download  build 1.6.1318.0 and test the inline styles feature of Html Rendering Extension. We have added the new setting that is called "CssStyleMode". Set it to "Inline" to get the output that uses the inline css styles.
    Please, let us know whether the implementation works as expected.
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    Hello Sergey,

    Thank you for working on this issue.
    That implementation worked nicely for Thunderbird. Outlook 2007 however, can't handle absolute positioning. This is also true for Gmail, but that's not a priority for us.
    Is there a way to get an output similar to Active Reports "Legacy"?
  • Replied 3 August 2017, 6:01 am EST

    Thanks for letting us know. We will be revisiting this issue to create a solution which works for you. A developer will be getting back with you to go over our design to ensure it works for you.



    Thanks,



    James Johnson

    Product Manager
  • Replied 3 August 2017, 6:01 am EST

    <font face="Arial" size="2">Meaning, just to be clear about this, that instead of writing DIV-layers, DD Report would write TABLE-tags.

    Thanks ahead
    </font>
  • Replied 3 August 2017, 6:01 am EST

    Hi,



    Any news on this issue? Is there a release date planned?



    /Anders
  • Replied 3 August 2017, 6:01 am EST

    My apologies for not replying in so long.

    The Email export will not be part of the next release but the one after.  The team is working on finishing up the export now and if you wish we can give you an early preview of it.

    James
  • Replied 3 August 2017, 6:01 am EST

    Is "the one after" the current release, meaning it should work in the major mail clients now? Thanks ahead
  • Replied 3 August 2017, 6:01 am EST

    Your last post was more then a month ago. Have anything happened? We can't find anything directly relating to this in the version logs.



    We intend to start implementing DD Reports in at least on of our web based business systems now, but with the state of this issue as it is we won't be able to replace AR.Net yet.
  • Replied 3 August 2017, 6:01 am EST

    The team is currently working on several large cases to improve the performance of the product several fold.  Once the team has reached the first goal in this endeavor I am planning to create the release which includes this feature. 

    Until then, I do want to make an interim release available to you which can be used to test this feature and provide feedback regarding the implementation.

    I will ask the team to prepare the interim release as part of our next iteration and once its done the support team will let you know that it is available.

    Thanks,

    James
  • Replied 3 August 2017, 6:01 am EST

    Hello James,

    That sounds really good indeed. Looking forward to it
    Do you know when this feature might be available?
  • Replied 3 August 2017, 6:01 am EST

    Hello,



    We are working to implement this and we will definitely notify you when this feature gets implemented successfully.

    As James said we will try to provide you an interim build before the final release to test with so that you can make sure it works for you.



    Thanks,

    Gaurav
  • Replied 3 August 2017, 6:01 am EST

    I wasn't allowed to attach a .cs file. I'll try again
    2010/02/ddreportTest.zip
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    Thanks for the feedback!
    I tried to repeat the "double cid:" problem on my side, but it does not arise..Can you send us rdlx file and the code you use for rendering?
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    Excellent. That seems to be working nicely. Only problem I can find is that an image that we embedded (as a linked resource) got the "cid:" tag twice (src="cid:cid:image.bmp"), but i'd assume that this is a small matter to correct.

    I checked to see if the extra "cid:" came from the secondary streams LocalPath, but that wasn't the case.



    Aside from that small bug: Great work!
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    Build 1.6.1749.0 can be downloaded from https://grapecity.sharefile.com/d-s6b3a94fcfa64dfd8
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    Good stuff. Please do.
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">Hello,
    We are preparing the public release this and/or next week. We can send you the interim build which is pretty close to what will be  in the release for tryout activities.
    </font></font>
  • Replied 3 August 2017, 6:01 am EST

    I think I've been able to locate the problem. I'm using the old MemoryStreamProvider-example that you've posted here in the forums previously, and in the CreateSecondaryStream method it adds "cid:" (to make the Uri constructor happy). I assume that's where the second cid: comes from.

    Is there a better way to do this nowadays?



    I've attached most of my source code (not the memorystreamprovider, since we havent tampered with your source code there).
  • Replied 3 August 2017, 6:01 am EST

    It works perfectly. Thanks :)
  • Replied 3 August 2017, 6:01 am EST

    <font face="Tahoma"><font size="2">EmailRenderingExtension class now exposes MailMessage property which returns the instance of System.Net.Mail.MailMessage which has the html view and the linked resources.
    Once the report is rendered, you can obtain that property value, feed it with From, To, Subject, etc. values and send.
    So, behind the scene EmailRE initializes MailMessage using the code which is very similar to one you sent. I think it does not have the bug you mentioned, we extensively tested this functionality. However, if you find any problems, let us know please.
    </font></font>
  • Replied 25 October 2018, 10:15 pm EST

    If you have the issue related these AOL sign in error, the message was not sent because of an error, AOL certificate error, service error AOL mail, AOL login error, how to delete AOL Account contact with AOL Email Support. visit here: https://www.aoltechsupportnumber.com/blog/how-to-close-a-free-aol-account/
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels