Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Office Web Components Errror

Status
Not open for further replies.

dswitzer

Technical User
Aug 2, 2002
298
US
Posted this in the VBScript forum -- but no responses so far.

Any ideas appreciated.....


Trying to do some simple charting for an in-house site and I keep getting an error:

Error Type:
Microsoft Office Web Components 9.0 (0x800A03EC)
The file c:\inetpub\could not be opened for export.
/pinnacle/chartExample2.asp, line 11

Sorry for all the code - but just can't get this.

<code>
<% Option Explicit %>
<HTML>
<HEAD>
<TITLE>Chart Example</TITLE>
<!-- #include virtual=&quot;/includes/adovbs.inc&quot; -->
<%
Function ExportChartToGIF(objCSpace, strAbsFilePath, strRelFilePath)
Dim strFileName
Randomize
strFileName = Timer & Rnd & &quot;.gif&quot;
objCSpace.ExportPicture strAbsFilePath & &quot;\&quot; & strFileName, &quot;gif&quot;, 600, 350
ExportChartToGIF = strRelFilePath & &quot;/&quot; & strFileName
End Function


Sub CleanUpGIF(GIFpath)
Dim objFS
Dim objFolder
Dim gif
set objFS = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
set objFolder = objFS.GetFolder(GIFpath)
for each gif in objFolder.Files
if instr(gif.Name, &quot;.gif&quot;) > 0 and DateDiff(&quot;n&quot;, gif.DateLastModified, now) > 10 then
objFS.DeleteFile GIFpath & &quot;\&quot; & gif.Name, True
end if
next
set objFolder = nothing
set objFS = nothing
End Sub

%>
</HEAD>
<BODY BGCOLOR=&quot;#FFFFFF&quot;>
<%
dim objChartSpace
dim objChart
dim objSeries
dim c
dim series
dim strChartAbsPath
strChartAbsPath = Server.MapPath(&quot;/pinnacle&quot;)

dim strChartRelPath
strChartRelPath = &quot;temp&quot;

dim strChartFile

set objChartSpace = Server.CreateObject(&quot;OWC.Chart&quot;)
set objChart = objChartSpace.Charts.Add()
set c = objChartSpace.Constants

objChart.Type = c.chChartTypeLineMarkers
objChart.HasLegend = True


'Database Connection & Recordset Creation
Dim objConn
set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)

objConn.Provider = &quot;Microsoft.Jet.OLEDB.4.0&quot;
objConn.Properties(&quot;Data Source&quot;) = Server.MapPath(&quot;Databases/Pinnacle.mdb&quot;)

objConn.Open

Dim strSQL
strSQL = &quot;SELECT * FROM chartExample&quot;

Dim objRS
Set objRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
objRS.Open strSQL, objConn, adOpenStatic


'Temp write out revenue data
Do While Not objRS.EOF
response.write objRS(&quot;revenue&quot;) & &quot;<br>&quot;
objRS.MoveNext
Loop

'response.end


set objChartSpace.DataSource = objRS
objChart.SetData c.chDimSeriesNames, 0, &quot;month&quot;
for each objSeries in objChart.SeriesCollection
objSeries.SetData c.chDimCategories, 0, &quot;revenue&quot;
objSeries.SetData c.chDimValues, 0, &quot;profit&quot;
next


'for each axis in objChart.Axes
' axis.HasTitle = True
' if axis.Type = c.chCategoryAxis then
' axis.Title.Caption = &quot;Revenue&quot;
' else
' axis.Title.Caption = &quot;Profit&quot;
' end if
'next

'objChart.SeriesCollection(2).Interior.Color = &quot;red&quot;
'objChart.SeriesCollection(2).Line.Color = &quot;red&quot;

strChartFile = ExportChartToGIF(objChartSpace, strChartAbsPath, strChartRelPath)
Response.Write &quot;<IMG SRC=&quot;&quot;&quot; & strChartFile & &quot;&quot;&quot;>&quot; & &quot;<P>&quot;
CleanUpGIF strChartAbsPath

objRS.Close
set objRS = nothing
set objConn = nothing
set objSeries = nothing
set objChart = nothing
set objChartSpace = nothing
%>
</BODY>
</HTML>

</code>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top