Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi,
I've created a chart in .net (vb) and now I'm trying to export my chart as a gif but I'm getting an "Exception from HRESULT: 0x800A03EC.:System.Runtime.InteropServices.COMExce ption" I think I know why I am getting the exception but I don't know how to specify the FILTERNAME object that the method wants Dim oXLChart As Excel.Chart oXLChart = oXLSheet.Parent.Charts.Add oXLChart.ChartType = Excel.XlChartType.xlXYScatterSmooth oXLChart.SetSourceData(oXLRange, oXLChartClass.PlotBy.xlColumns) oXLChart.Location(Excel.XlChartLocation.xlLocation AsNewSheet, "TEST2") oXLChart.SeriesCollection.Add(oXLYRange) Try oXLSeriesCollect = oXLChart.SeriesCollection oXLSeriesCollect.Item(oXLSeriesCollect.Count).Sele ct() With oXLSeriesCollect.Item(oXLSeriesCollect.Count) .AxisGroup = Excel.XlAxisGroup.xlSecondary .Border.Color = RGB(30, 144, 255) .Border.LineStyle = Excel.XlLineStyle.xlContinuous .Border.Weight = Excel.XlBorderWeight.xlThin .MarkerBackgroundColorIndex = 38 .MarkerForegroundColorIndex = 41 .MarkerStyle = Excel.Constants.xlTriangle .Smooth = True .MarkerSize = 5 .Shadow = False End With Catch ex As Exception curError = New SBTestError curError.SetError(curError.generalError, "UNEXPEDTED ERROR!!" + ex.Message & ":" + ex.GetType.ToString() + ": " & ex.StackTrace) sbErrorCollection.Add(curError) End Try 'do some formating stuff then try to export, oXLChart.Export("c:\temp\katieimage.gif", "gif", False) The definition for chart export method is Export(ByVal Filename As String, ByVal FilterName As Object..,By Val Interactive As Object) As boolean Has anyone else tried to use this method and are able to specify the filtername parameter? I know others have used the Microsoft.Office.Interop.Owc11 Chartspace export picture method but I'd have to rewrite all the code to create the chart. Thanks! |
#3
![]() |
|||
|
|||
![]()
Dunno about all that .Net stuff, but this works in regular VBA:
oXLChart.Export "c:\temp\katieimage.gif", "gif" - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ Katie wrote: Hi, I've created a chart in .net (vb) and now I'm trying to export my chart as a gif but I'm getting an "Exception from HRESULT: 0x800A03EC.:System.Runtime.InteropServices.COMExce ption" I think I know why I am getting the exception but I don't know how to specify the FILTERNAME object that the method wants Dim oXLChart As Excel.Chart oXLChart = oXLSheet.Parent.Charts.Add oXLChart.ChartType = Excel.XlChartType.xlXYScatterSmooth oXLChart.SetSourceData(oXLRange, oXLChartClass.PlotBy.xlColumns) oXLChart.Location(Excel.XlChartLocation.xlLocation AsNewSheet, "TEST2") oXLChart.SeriesCollection.Add(oXLYRange) Try oXLSeriesCollect = oXLChart.SeriesCollection oXLSeriesCollect.Item(oXLSeriesCollect.Count).Sele ct() With oXLSeriesCollect.Item(oXLSeriesCollect.Count) .AxisGroup = Excel.XlAxisGroup.xlSecondary .Border.Color = RGB(30, 144, 255) .Border.LineStyle = Excel.XlLineStyle.xlContinuous .Border.Weight = Excel.XlBorderWeight.xlThin .MarkerBackgroundColorIndex = 38 .MarkerForegroundColorIndex = 41 .MarkerStyle = Excel.Constants.xlTriangle .Smooth = True .MarkerSize = 5 .Shadow = False End With Catch ex As Exception curError = New SBTestError curError.SetError(curError.generalError, "UNEXPEDTED ERROR!!" + ex.Message & ":" + ex.GetType.ToString() + ": " & ex.StackTrace) sbErrorCollection.Add(curError) End Try 'do some formating stuff then try to export, oXLChart.Export("c:\temp\katieimage.gif", "gif", False) The definition for chart export method is Export(ByVal Filename As String, ByVal FilterName As Object..,By Val Interactive As Object) As boolean Has anyone else tried to use this method and are able to specify the filtername parameter? I know others have used the Microsoft.Office.Interop.Owc11 Chartspace export picture method but I'd have to rewrite all the code to create the chart. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|