Including images on Excel export

Hi,

I believe that there is already something like this on the export option of dundas, but unfortunately we can’t expose that tab and will need to use the JS API instead.

How could I include an image of a visualization on an Excel export using the js API?

Regards,
Renzi

Hi Renzi,

We have some sample scripts in the script library that you can refer to in order to get the script for exporting the dashboard to excel on click of a button, using JS.
https://www.dundas.com/support/developer/script-library/export/create-an-excel-export
Including an image to the excel export is a property that you can set in the following manner:

var includeImageOfEachItem = new dundas.data.SingleBooleanValue; includeImageOfEachItem.parameterId = dundas.constants.INCLUDE_ADAPTER_IMAGES_ID; includeImageOfEachItem.value = true;

You will then have to push this parameter to the export request:
exportRequest.parameterValues.push(includeImageOfEachItem);

This will include an image of all the visualizations in their respective tabs in excel export.

I hope this helps. Please let me know in case you have any queries in this.

Thank you so much for the reply

How would the script look like if I would just want to export the images of specific visualizations?

Hi Renzi,

In that case, you can refer to the below sample script from our script library:
https://www.dundas.com/support/developer/script-library/export/export-specific-visualization-to-image
Using this script you can export a specific visualization on your dashboard to image.

Hi @pankaj,

Thank you for the reply on the images.
But, I believe I have not been very clear on my last question. Can we choose which visualization would be exported in Excel with an image? (If there are 3 visualizations in the dashboard, could we just choose 2 to have an image included?)

Hi Renzi,

There is no setting using which you can skip the “image include” for one of your visualizations. However, there is a way in which you can still achieve this.
For that, first, disable the export option on the visualization that you don’t want to include image for:
image
Then you create a copy of this visualization and from the property panel you can hide this copied visualization:
image

Make sure this copied visualization has export enabled (prevent data export option unchecked). Now, when you use the script to export to excel with images included you will get this visualization in the export but will not get an image for this visualization.

I hope this helps.

1 Like

Thanks @pankaj! I will try it out

Is there any way I can export the images in a table to excel?

A good request - I’ve created a feature request ticket for you ref#80474 which you can check with the support team at any time for a status update. (support@dundas.com)

Is there also a way the we could include the Legend for a chart with the image?

Hi @renzi.mendoza ,

It depends on how you are exporting. There are currently two modes.

  1. Export Individual Items - this lets you choose specific visualizations which are exported. Legends will not be exported.

  2. Export Entire Dashboard - this will export everything on the screen, as is. If you have a legend it will be exported.

If you’re hoping for different behavior you could also reach out to support@dundas.com with a use case and ask them to create a feature request for you. The more pictures and supporting info you can provide the better.

Thanks @jeff.

What we do need is not in the options you’ve presented. What we have right now is:

  • charts have no labels then a separate Legend is provided to identity the parts of the chart. However, we are exporting on the visualization level which the image for the Legend is not included.

The problem right now is that when exported the parts of the chart could not be identified right away because the labels are not included with the exported image of the chart.

Hi Renzi,

I just learned that we do in-fact export the legend under some conditions!

Working example:
image

The legend will be exported with your chart if you make sure that:

  1. The legend is only bound to a single visual
  2. The legend is placed within the bounds of the chart

Also, if you have a dashboard where for design reasons you have a legend elsewhere but you want it to meet this criteria on export - it’s possible too. Use the Export Event on the dashboard and script move your elements to meet the above requirements. This use of the Export Event will allow you to have an export experience and a viewing experience.

Hope this helps

1 Like

Could you give a sample script to move the legend?

Thank you so much.

Hi @renzi.mendoza,

This is really just a matter of setting the position properties of the legend.

example:
legend1.left = 100;
legend1.top = 100;

you might also wish to be intelligent with your script can move based on the position of another control. Something like:

legend.left = chart1.left + chart1.width - legend.width - 10;

1 Like

Hi @jeff,

I’m having trouble for Dundas 7 for this solution. It seems that the before export event is not being triggered. Does the behavior changed in between versions?

Regards,

Renzi

Hi @renzi.mendoza,

I’m not aware of any changes that would impact this in version 7. I’d recommend opening a support ticket if it is no longer working for you.

jeff