This question is locked. New answers and comments are not allowed.
Michael Nichols
Top achievements
Rank 1
Michael Nichols
asked on 04 Aug 2009, 12:03 AM
Hello,
We have an Image column in our GridView which is just a byte[] in the datasource with a converter that turns the byte[] into an ImageSource. And this works fine for displaying on the screen. However, we have been unable to actually export the image using the Grids ability to export to xls. The column simply displays the text "byte[]", which is Im guessing is the .ToString() of the image's byte array.
Does anyone know of a way to do this? (Note: we are using SL3, if that helps)
~Michael
We have an Image column in our GridView which is just a byte[] in the datasource with a converter that turns the byte[] into an ImageSource. And this works fine for displaying on the screen. However, we have been unable to actually export the image using the Grids ability to export to xls. The column simply displays the text "byte[]", which is Im guessing is the .ToString() of the image's byte array.
Does anyone know of a way to do this? (Note: we are using SL3, if that helps)
~Michael
5 Answers, 1 is accepted
0
Hi Michael,
Currently exporting of images is not supported.
All the best,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Currently exporting of images is not supported.
All the best,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Michael Nichols
Top achievements
Rank 1
answered on 05 Aug 2009, 11:15 AM
Hello Vlad,
If the GridView's export does not support Images, does the format the GridView is being exported to support it? I mean, your export returns a string. Here is an example:
<table style="border-collapse:collapse" border="1">
<tr style="background:#808080;color:#FFFFFF;font-size:20;font-weight:Bold;height:50"><td></td><td></td><td>Code</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>NEW_PROJ</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>KZA_FIRE</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>NEW_TEST</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>NEW_ONE</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>KZA</td></tr>
</table>
It should be fairly simple to make a pass over the exported string and replace the byte[] value with a value that excel can interpret as an image (assuming such a value exists). Searching online isnt much help since I am not familiar with the supported file formats of the xls extenstion.
This appears to be HTML so perhaps an <img> tag with the src set to the image (which would have to be enbedded into the html), might work?
If the GridView's export does not support Images, does the format the GridView is being exported to support it? I mean, your export returns a string. Here is an example:
<table style="border-collapse:collapse" border="1">
<tr style="background:#808080;color:#FFFFFF;font-size:20;font-weight:Bold;height:50"><td></td><td></td><td>Code</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>NEW_PROJ</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>KZA_FIRE</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>NEW_TEST</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>NEW_ONE</td></tr>
<tr style="background:#FFFFFF;color:#000000"><td>False</td><td>byte[]</td><td>KZA</td></tr>
</table>
It should be fairly simple to make a pass over the exported string and replace the byte[] value with a value that excel can interpret as an image (assuming such a value exists). Searching online isnt much help since I am not familiar with the supported file formats of the xls extenstion.
This appears to be HTML so perhaps an <img> tag with the src set to the image (which would have to be enbedded into the html), might work?
0
Accepted
Hello Michael,
Indeed <Img> can work when the format is HTML however these images should be external images saved somewhere with relative or absolute paths. In both formats (HTML and ExcelML) embedded images are not supported.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Indeed <Img> can work when the format is HTML however these images should be external images saved somewhere with relative or absolute paths. In both formats (HTML and ExcelML) embedded images are not supported.
Kind regards,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
jeffrey bk
Top achievements
Rank 1
answered on 13 Jan 2010, 08:26 PM
Would you please be able to post a sample of the grid using external img url ?
regards
jeff
0
Hello jeff,
If you have following in the document content:
<img src="YourImage.jpg" />
and such image is located in the same folder you will be able to see these images in the document.
Sincerely yours,
Vlad
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.
If you have following in the document content:
<img src="YourImage.jpg" />
and such image is located in the same folder you will be able to see these images in the document.
Sincerely yours,
Vlad
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.
