Problem of exporting image in HTML format using HtmlFormatProvider

17 posts, 0 answers
  1. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 17 Nov 2011 Link to this post

    Hi,
    I m facing a big problem i do not understand when i export a raddocument which contains an image in HTML format using HtmlFormatProvider. The strange situation is that i can export successfully the document when i run my application on some PC using IE8 while other some PC can not. But what it seems to be  strange to me, all PC are using the same operating system  (Windows 7) and the same browser (IE8). I m using  2011.2.920.1040 telerik version. I tried to change different ImageExportMode in the  ExportSettings but still have the same problem. Can u provide some ideas how to overcome this misbehavior if it is a well known problem ? I really need some workaround on this.

    Thank u for your precious help.
  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 23 Nov 2011 Link to this post

    Hello Guy,

    Could you attach the image that is causing the issue and elaborate a bit more on your scenario and the issue itself.
    1. How are you exporting the document (a code-snippet will be appreciated if you are not using RadRichTextBoxRibbonUI to trigger the saving of the document).
    2. Are you creating the document in the rich text box or building it in code-behind? If you are not creating the document in the editor, a code-snippet for that may also be helpful.
    3. What exactly is the problem with the export?
    3.1 An exception occurs - in that case, please copy the stacktrace to give us an idea of what may be wrong.
    3.2 The image is not visible in the exported HTML - we can test that once you attach the image.
    4. To make sure I understand you correctly, you are observing the issue when exporting the image from a PC using Windows 7 and IE 8, while the export works correctly on other machines?
    Looking forward to your reply. If you have a sample demo illustrating the problem, please attach it, so that we can reproduce the issue more easily.

    Regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 23 Nov 2011 Link to this post

    Hello Iva,
    Thank you for your quick reply. Here is the code snippet i used to create the RadDocument containing  an image from a RadChart:

    public RadDocument CreateDocumentFromRadChartForHTML(RadChart chart)
     {
       RadDocument document = new RadDocument();
       document.LayoutMode = DocumentLayoutMode.Paged;
        try
         
          //
          // Create here sections conatining some information i want to export....
          //
          // Export image in the memory
              MemoryStream memoryStream = new MemoryStream();
              chart.ExportToImage(memoryStream);
             //create image section
             Section imageSection = new Section();
              Paragraph imgParagraph = new Paragraph();
              int width = 700;
               int height = 380;
               Size sizeImg = new Size(width, height);
               ImageInline img = new ImageInline(memoryStream, sizeImg, "PNG");
               imgParagraph.Inlines.Add(img);
               imageSection.Children.Add(imgParagraph);
               document.Sections.Add(imageSection);
               }
               catch (Exception ex)
               {
               }
               return document;
           }
     

    After creating the document i export it in HTML format  using HtmlFormatProvider. As I said in the previous message, on some PC the HTML file contains all information i inserted including the image while others can not display the image in the exported HTML file. But both machines use Windows 7 and IE8. I attached the picture when the image doesn' t display properly.
    Thank you for your precious help 
  5. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 28 Nov 2011 Link to this post

    Hello Guy,

    Thank you for the follow-up. We managed to reproduce the issue.
    The problem seems to be resolved in Internet Explorer 9, but we will review the export and see what can be done to have the images appear correctly in IE 8 as well.
    If you like, you can open a support ticket and attach sample documents exported to XAML, which illustrate the issue when imported through XamlFormatProvider and exported to HTML. We could use them for reference when addressing the issue.

    Best wishes,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 13 Dec 2011 Link to this post

    Hi Iva,

    Thanks for your replay. The problem happens only on IE8. I will create the support ticked for this problem.

    Best regards
  7. Mike
    Admin
    Mike avatar
    640 posts

    Posted 19 Dec 2011 Link to this post

    Hello Guy,

    We have logged the issue in our to-do list however unfortunately we would not be able to fix the problem for the upcoming service pack release. We will do our best to resolve it for the subsequent release. In the meanwhile you would help us a lot if you send the problematic image in a support ticket.

    Greetings,
    Mike
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 19 Dec 2011 Link to this post

    Hello Mike,

    I would like to send the problematic image in a support ticket.
    I tried but i didn't  find how to add this. Can you explain me how can i proceed for addind this support ticket ?

    Regards,
    Guy
  9. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 20 Dec 2011 Link to this post

    Hi Guy,

    You can open a support ticket following these steps:
    1. Log in your account at telerik.com and go to Your account;
    2. From the Quick links on the right choose "Get Support";
    3. From "Step 3" choose "Contact Support Team";
    4. Click the "Submit ticket" button under "RadControls for Silverlight";
    5. Fill in the issue area, choose the product and the version, enter the subject and the version and attach the file using the link at the very bottom of the page. 

    Best wishes,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  10. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 21 Dec 2011 Link to this post

    Hi Iva,

    Thanks for your information. I added a support ticket for the problem of displaying image.

    Best regards,

    Guy
  11. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 22 Dec 2011 Link to this post

    Hello Guy,

    We have received your support ticket.
    Once again, thank you for the cooperation.

    Greetings,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  12. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 24 Jan 2012 Link to this post

    Hi, 

    The same problem of displaying image appears also when i export the same document in excel format using HtmlFormatProvider. The image does not display. I tried Excel 2007 and Exel 2010 and both display correcty the content of the RadDocument except the RadChat image.

    Thank u for your precious help.

    Guy
  13. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 26 Jan 2012 Link to this post

    Hello Guy,

    Thank you for reporting this issue.
    We have logged it for revision and will look into the matter. Hopefully, we will manage to squeeze a fix in 2012 Q1.

    Kind regards,
    Iva Toteva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  14. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 12 Mar 2012 Link to this post

    Hello Iva,

    I tried the new controls (2012 Q1) and also the latest internal builds for both silverlight 4 and 5 but the problem of exporting document containing image in Html format (IE8) and in Excel 2007/2010 still happen. The image does not display...Is there any workaround i can do for this because it 's very important for my application. Thank you for your precisous help.

    Best regards,

    Guy
  15. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 15 Mar 2012 Link to this post

    Hello Guy,

    Unfortunately, there is no workaround you could use with IE 8 and Excel. The bug is still on our to-do list and we will try to address it in 2012 Q2.
    Please excuse us for the inconvenience.

    Greetings,
    Iva Toteva
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  16. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 17 Sep 2012 Link to this post

    Hi Iva,

    I d'like to know if the problem of display image when export in Excel format using HtmlFormatProvider  has been fixed in  current release version.

    King regards,

    Guy
  17. Mihail
    Admin
    Mihail avatar
    192 posts

    Posted 18 Sep 2012 Link to this post

    Hello Guy,

    We've made further research on the subject and it seems that there are some limitations in MS Word and IE 8.

    The limitation of IE 8 is the length of the embedded data which it can read. For this reason we have prepared a workaround - if the image is larger than the limitation, we split it in many smaller images placed in a table so it can look the same as the original. In order to use this fix you need to set the "ImageExportMode" to "Base64EncodedSplit". We also reduced even more our internal check for this length limitation just to make sure there is no problematic images. This additional fix will be available with the next LIB. Setting the export mode of images and other HTML export/import customizations are described here.

    When it comes to MS Word and Excel, they do not support base64 embedded data. A possible workaround for you can be to attach a handler to the ImageExporting event of HtmlExportSettings and have the ImageExportMode of the settings specified to be ImageExportingEvent. In the handler, you can save the image on a server with permissive cross-domain policy and have the source of the images replaced with the new URI. 

    Another workaround for this problem would be to use the default HTML export settings and convert the HTML file to MHT format using some tool. According to MS Word documentation there shouldn't be any problems with MHT format.

    Depending on your application you can use DocxFormatProvider or RtfFormatProvider to export documents to MS Word.

    When it comes to the image you have attached in ticket 495110, the export to HTML with Base64EncodedSplit option now works correctly in IE 8.

    All the best,
    Mihail
    the Telerik team

    Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

  18. Guy
    Guy avatar
    46 posts
    Member since:
    Nov 2008

    Posted 18 Sep 2012 Link to this post

    Hi Mihail,

    Thank you so much for this quick replay. I have used the second option using  ImageExporting event  and it works perfectly.

    King regards,

    Guy
Back to Top
DevCraft banner