Hi there,
Thanks for the quick reply. The relevant code as requested:
m_appExcel.CalculateFormula()
Dim mysheet As Worksheet = m_appExcel.Worksheets(sSheet)
Dim bitmap As System.Drawing.Bitmap
Dim oChart As Charts.Chart
Try
Dim oOptions As New Rendering.ImageOrPrintOptions
oOptions.HorizontalResolution = 300
oOptions.VerticalResolution = 300
If IsNumeric(sEntityNumber) Then
oChart = mysheet.Charts(CInt(sEntityNumber) - 1)
Else
oChart = mysheet.Charts(sEntityNumber)
End If
If Not oChart Is Nothing Then
oChart.Calculate()
bitmap = oChart.ToImage(oOptions)
Else
LogEvent(m_sJobStartTime, LogType.LogError, "Unable to locate the chart " & sEntityNumber & ".")
Exit Sub
End If
Catch ex As Exception
LogEvent(m_sJobStartTime, LogType.LogError, "Unable to locate the chart " & sEntityNumber & ".")
Exit Sub
End Try
Dim sFile As String = m_sResultsFolder & "\" & sTitle & ".png"
'Save the chart image file to disk.
bitmap.Save(sFile, System.Drawing.Imaging.ImageFormat.Png)
Hope this helps!
Cheers,
Steve