I’m dealing with exporting excel chart/s via using vb.net. There is problem with when i exporting charts as a png format. When i open the chartImage.png the quality is very low like a blur, it’s hard to read.
Is there a way to increase the quality via using vb.net or activities(It cannot be 3rd partions)?
NOT : I’m not taking screenshot.
For now i cannot share the picture of charts. Because of security problem.
Ensure that you are exporting the chart with the desired size and resolution. You can set the width and height of the image to a larger value to get a higher quality image. For example, use the
You can set the resolution (DPI) of the exported image. Higher resolution results in better quality. You can set it using the
chartImage.SetResolution(300, 300) ' Set to 300 DPI
Depending on your needs, consider using other image formats that may provide better quality than PNG. Formats like JPEG, TIFF, or BMP may be suitable for certain use cases.
There are three ways to handle this
- Using vb itself where Specify a higher DPI (Dots Per Inch): DPI controls the image’s resolution. A higher DPI results in a higher quality image. You can set the DPI using code like this:
chart.Export("chartImage.png", "PNG", resolution:=300)
In the code above,
resolution:=300 sets the DPI to 300, which is considered high quality for images.
Using TAKE SCREENSHOT activity from UiPath
Using custom component to export chart from excel as a image
UiPathGo - BalaReva Excel Activities - #28 by balupad14
Hope this helps
Do you use GetChart activity? If not, how about the following?
Hi thanks for answer.
What is type of chartImage?
The type of the chartImage variable depends on how you obtain or create the image.
Bitmap or Image : System.Drawing.Bitmap or System.Drawing.Image
you can use System.Drawing.Bitmap