Need help with getting OWC10 or 11 to work with ASP.NET

B

Bob [BVP]

I cannot get this to work for some reason.. I keep getting this
no matter what I do.. This a convert from ASP to ASP.NET
All assemblies have been installed, and machine.conf. updated
per 4guys.. I am at my whits end here.. and going to go buy
a charting component because I just can't seem to find any
descent support or docs on this product.. Any ideas ? Error
and the source follows.. the setdata fails no matter what I
put in there.. literal array, etc.. blah.. I have re-installed owc10
etc.. Thanks for your help..

Bob

===================
Exception Details: System.Runtime.InteropServices.COMException: Member not found.
Source Error:


Line 31: oChart.Charts(0).SeriesCollection.Add()
Line 32: oChart.Charts(0).SeriesCollection(0).Caption = "Pie Chart Caption"
Line 33: oChart.Charts(0).SeriesCollection(0).SetData(c.chDimCategories, c.chDataLiteral, pCat)




<%@ Page language="VB" aspcompat=true Debug="true" %>
<%@ import Namespace="System.IO" %>
<%@ import Namespace="Microsoft.Office.Interop.OWC" %>
<%@ import Namespace="Microsoft.VisualBasic" %>

<script language="VB" runat="Server">
Dim sFname As String
Dim c As Object
Dim oChart As Object
Dim nOrg As Byte
Dim sCaption As String
Dim pCat,pVals As Object
</script>

<html>
<body>
<form runat="server">
<h1>Realtime CPU Utilization by Configurations</h1>
<%'When the page loads the first time, set ndata to 5
pCat = "A,B,C,D,E"
pVals = "1,2,3,4,5"
' Create a Chart Object
'UPGRADE_NOTE: The 'OWC10.Chartspace' object is not registered in the migration machine. Copy this
link in your browser for more: ms-its:D:\Program Files\ASP to ASP.NET Migration
Assistant\AspToAspNet.chm::/1016.htm
oChart = Server.CreateObject("OWC10.Chartspace")
'oChart = New OWC.ChartSpace
'oChart = New OWC10.ChartSpace
c = oChart.Constants
oChart.Border.Color = c.chColorNone
oChart.Charts.Add()
oChart.Charts(0).Type = 18
oChart.Charts(0).SeriesCollection.Add()
oChart.Charts(0).SeriesCollection(0).Caption = "Pie Chart Caption"
oChart.Charts(0).SeriesCollection(0).SetData(c.chDimCategories, c.chDataLiteral, pCat)
oChart.Charts(0).SeriesCollection(0).SetData(c.chDimValues, c.chDataLiteral, pVals)
oChart.Charts(0).HasLegend = True
oChart.Charts(0).HasTitle = True
sFname = "Blah" & rnd(100) & "_" & Session.SessionID & ".gif"
oChart.ExportPicture(Server.MapPath(sFname), "gif", 400, 340)
Response.Write("<img src='" & sFname & "'>")

%>
</form>
</body>
</html>
 
S

Spaceghost

using Office XP and PIA changes some things - makes it easier - intellisense

don't use server.createobject when using PIA

this is an asp.net page written in vb.net

sorry about font - cut & paste from vs 2003 ide

this is the code behind an asp.net page - just the chart stuff - load your own arrays

_____________________________________

Imports Microsoft.Office.Interop.OWC

Dim myChartSpace As New ChartSpace

'create the Chart within the ChartSpace

Dim myChart As ChChart = myChartSpace.Charts.Add(0)

' setup the chart

With myChart

..Interior.Color = "white"

..PlotArea.Interior.Color = "wheat"

..HasLegend = True

..HasTitle = True

..Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom

..Title.Caption = strTitle

..Title.Font.Size = 9

..Title.Font.Bold = True

..Type = ChartChartTypeEnum.chChartTypeColumnClustered

End With



'create the series within the chart

myChart.SeriesCollection.Add()

With myChart.SeriesCollection(0)

..SetData((ChartDimensionsEnum.chDimCategories), (ChartSpecialDataSourcesEnum.chDataLiteral), dat)

..SetData((ChartDimensionsEnum.chDimValues), (ChartSpecialDataSourcesEnum.chDataLiteral), values)

..Caption = This is my caption"

' End With

' set up the axes

With myChart.Axes(0)

..GroupingType = ChartAxisGroupingEnum.chAxisGroupingNone

..Font.Name = "verdana"

..HasTitle = True

..Title.Font.Size = 10

..Title.Caption = "This is my caption"

End With

With myChart.Axes(1)

..GroupingType = ChartAxisGroupingEnum.chAxisGroupingNone

End With

' stream the chart

With Response

..Buffer = True

..Clear()

..ContentType = "image/jpeg"

..BinaryWrite(myChartSpace.GetPicture("jpeg", 984, 558))

..End()

End With
 
B

Bob [BVP]

Thanks.. I will try this.. although I was doing everything inline with asp classic, I guess I need
to jump into the codebehind scene of .net.
using Office XP and PIA changes some things - makes it easier - intellisense

don't use server.createobject when using PIA

this is an asp.net page written in vb.net

sorry about font - cut & paste from vs 2003 ide

this is the code behind an asp.net page - just the chart stuff - load your own arrays

_____________________________________

Imports Microsoft.Office.Interop.OWC

Dim myChartSpace As New ChartSpace

'create the Chart within the ChartSpace

Dim myChart As ChChart = myChartSpace.Charts.Add(0)

' setup the chart

With myChart

.Interior.Color = "white"

.PlotArea.Interior.Color = "wheat"

.HasLegend = True

.HasTitle = True

.Legend.Position = ChartLegendPositionEnum.chLegendPositionBottom

.Title.Caption = strTitle

.Title.Font.Size = 9

.Title.Font.Bold = True

.Type = ChartChartTypeEnum.chChartTypeColumnClustered

End With



'create the series within the chart

myChart.SeriesCollection.Add()

With myChart.SeriesCollection(0)

.SetData((ChartDimensionsEnum.chDimCategories), (ChartSpecialDataSourcesEnum.chDataLiteral), dat)

.SetData((ChartDimensionsEnum.chDimValues), (ChartSpecialDataSourcesEnum.chDataLiteral), values)

.Caption = This is my caption"

' End With

' set up the axes

With myChart.Axes(0)

.GroupingType = ChartAxisGroupingEnum.chAxisGroupingNone

.Font.Name = "verdana"

.HasTitle = True

.Title.Font.Size = 10

.Title.Caption = "This is my caption"

End With

With myChart.Axes(1)

.GroupingType = ChartAxisGroupingEnum.chAxisGroupingNone

End With

' stream the chart

With Response

.Buffer = True

.Clear()

.ContentType = "image/jpeg"

.BinaryWrite(myChartSpace.GetPicture("jpeg", 984, 558))

.End()

End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top