Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
xamdataGrid with PNG images exporting to Excel
posted

I havea  XamDatagrid with fields in some columsn and PNG icons as ImageFields in otrher columns.  These are green UP and red Down arrows.

When I export thee to Excel using the Excel exporter, the imags appear correctly in the spreadsheet, but I get loads of exceptions thrown  - something to do with Bitmap.Media.

This slows it down very significantly, but it eventually gets there and gives me the result I want.

Should i be using a different format of image file, or should I be doing something differently ?

Here is a sample of my XAML 

<ig:Field Label="Cases"
AlternateBinding="{Binding Casesthisyear, Mode=TwoWay}" HorizontalContentAlignment="Right" Format="##,###,###">
<ig:Field.Settings>
<ig:FieldSettings AllowHiding="Default" AllowEdit="False" Width="auto" />
</ig:Field.Settings>
</ig:Field>

<ig:Field Label="Cases LY"
AlternateBinding="{Binding Caseslastyear, Mode=TwoWay}" HorizontalContentAlignment="Right" Format="##,###,###">
<ig:Field.Settings>
<ig:FieldSettings AllowHiding="Default" AllowEdit="False" Width="auto" />
</ig:Field.Settings>
</ig:Field>

<ig:ImageField AlternateBinding="{Binding Casesthisyearicon, Mode=TwoWay}" Width="25" ImageHeight="15" ImageWidth="20" />

Casesthisyearicon will contain one of 3 values, such as 

      "pack://application:,,,/SFE_UI;component/Images/Icons/icons8-thick-arrow-pointing-down-96.png"

Parents
No Data
Reply
  • 7375
    Offline posted

    Hello Gordon,

    Thank you for your post. Are you getting these images from your underline datasource ? If so, then can you change your AlternateBinding to name binding , something like this , and check if you still getting these Bitmap.Media exception?

    <igDP:ImageField Name="Casesthisyearicon" ImageHeight="30" ImageWidth="30" />


    If you still getting the exceptions , the best way for us to assist you is if you provide a small isolated sample that we can run and use for debugging locally.

    Sincerely,
    Divya Jain

Children
No Data