ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Report.ExportToImage() triggers error

Hi, im trying to export 2DAxis to a png file, but i error, the code is simple like this and the report object exists and has one curve

 

Report.Settings.ImageExport.PNG.BitsPerPixel = ePNGBitsPerPixelRGB24
Report.Settings.ImageExport.PNG.Width = 300
Report.Settings.ImageExport.PNG.UseRatio = True
Call report.ActiveSheet.Objects("2DAxis1").ExportToImage("C:\DEV\axis", eImageExportTypePNG)

I tried it like this without file extension specified like is written in help, and as well with extension. still the same error:

 

exportImageError.png

Diadem 2017 64bit, windows 7

0 Kudos
Message 1 of 6
(3,454 Views)

i wrote something but i wanted to delete it after, but i didnt find button to delete post or whole thread...

0 Kudos
Message 2 of 6
(3,437 Views)

I found out how to walk around the problem, before exporting the axis, i apply this code to move it to front and then it exports without error

 

Report.ActiveSheet.Objects("2DAxis1").Position.ZOrder.MoveToForeground
0 Kudos
Message 3 of 6
(3,435 Views)

Would it be possible to share the report causing the issue?

0 Kudos
Message 4 of 6
(3,422 Views)

attached, i just delete curve inside, so add some curve

0 Kudos
Message 5 of 6
(3,419 Views)

I tried to reproduce the error with the following script

Option Explicit

data.Root.clear
DataFileLoad ProgramDrv & "\Libr\Data\Example.tdm"

report.LoadLayout currentScriptPath & "report.tdr"
dim curve : set curve = Report.Sheets("15-11KNSLRI00H3DSXC").Objects("2DAxis1").Curves2D.Add(e2DShapeLine,"My2DCurve")
curve.Shape.XChannel.Reference = "[1]/[1]" 
curve.Shape.YChannel.Reference = "[1]/[2]"
Call Report.Refresh()

Report.Settings.ImageExport.PNG.BitsPerPixel = ePNGBitsPerPixelRGB24
Report.Settings.ImageExport.PNG.Width = 300
Report.Settings.ImageExport.PNG.UseRatio = True
Call report.ActiveSheet.Objects("2DAxis1").ExportToImage(currentScriptPath & "axis", eImageExportTypePNG)

but it does not show the behavior on my machine. Would it reproduce it on your machine?

0 Kudos
Message 6 of 6
(3,416 Views)