Wrox Programmer Forums
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old April 17th, 2004, 10:56 AM
Authorized User
Join Date: Sep 2003
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default office web components trouble!!!

Hi everyone,
I hope someone will be able to help.... i am using ASP technology (incorperating a VB DLL as a middle tier) and I want to use office xp web components to generate dynamic graphs.. i have downloaded the owc toolpack too but nothing seems to work for me.... i have tried several differnt ways of coding this but with no success.

Basically..... I am returning a recordset with 2 variables "program" and "number".... I want to chart each "number" for each "program"... Below id the cde I have implemented.. (I have also registered the required DLLs)

Many Thanks. Kkathryne


<%@ Language=VBScript %>

<title>Create Report</title>


dim strUserID
dim strTime
dim strProgram
dim strSeverity
dim strStatus
dim objProj
dim adoRS

Dim objConstants, objFont, objChart, objCSpace, objAxis
Dim objBinaryFile, FSO

  strUserID = Request.Form("txtUserID")
  strTime = Request.form("txtTime")
  strProgram = Request.form("txtProgram")
  strSeverity = Request.form("txtSeverity")
  strStatus = Request.form("txtStatus")


<table id=TblTitle width="100%" >
    <tr height="63" style="HEIGHT: 63px">

    <td width="100" style="WIDTH: 100px"><img src="file:///D|/Inetpub/wwwroot/defect/images/logo.bmp" width="70" height="51"
      style="WIDTH: 86px; HEIGHT: 84px">
        <h1 align="center">Create Report</h1>
      <td width="100" style="WIDTH: 100px"><h6 align="center">Nissan

      </h6><h6 align="center">Defect
      Tracking System



'Get Data for graph

  set objProject1 = Server.CreateObject("Project1.Class1")
  set adoRS = objProject1.MakeChart()
  set objProject1 = nothing

Response.ContentType = "image/gif"

'create the chart object
set objCSpace = Server.CreateObject("OWC.Chart")

'set up chart and properties
set objChart = objCSpace.Charts.Add()
set objConstants = objCSpace.Constants

'create a clustered column chart
objChart.Type = objConstants.chChartTypeColumnClustered

'add a legend
objChart.HasLegend = True

'set the data source to the recordset
set objCSpace.DataSource = adoRS

'set the data points and categories

objChart.SetData objConstants.chDimCategories, 0, "Programs"
objChart.SetData objConstants.chDimValues, 0, "Defects"

'set up some additional properties
'add and format the chart title
objChart.HasTitle = True
objChart.Title.Caption = "Number of Defects outstanding by Program"
set objFont = objChart.Title.Font
objFont.Name = "Tahoma"
objFont.Size = 12
objFont.Bold = True

'add and format a title to the category axis
set objAxis = objChart.Axes(objConstants.chAxisPositionBottom)
objAxis.HasTitle = True
objAxis.Title.Caption = "Programs"
set objFont = objAxis.Title.Font
objFont.Name = "Tahoma"
objFont.Size = 8
objFont.Bold = True

'add and format a title to the value axis
'set objAxis = cht.Axes(objConstants.chAxisPositionLeft)
'objAxis.NumberFormat = "Number"
'objAxis.HasTitle = True
'objAxis.Title.Caption = "Dollars"
'set objFont = objAxis.Title.Font
'objFont.Name = "Tahoma"
'objFont.Size = 8
'objFont.Bold = True

 'Save the current chart to a GIF file with a temporary
'filename using the FSO
set fso = Server.CreateObject("Scripting.FileSystemObject")
strFileName = Server.MapPath(".") & "\" & fso.GetTempName()
objCSpace.ExportPicture strFileName, "gif", 800, 400

'Use On Error Resume Next to make sure we eventually delete
'the temporary GIF file even if something fails in the next
'couple of functions
on error resume next

'The GIF file has been created. Return the contents of the
'GIF file as binary data using the BinaryFileStream COM object
set objBinaryFile = Server.CreateObject("BinaryFileStream.Object")
Response.BinaryWrite objBinaryFile.GetFileBytes(CStr(strFileName))

'Delete the GIF file since it is no longer needed
objBinaryFile.DeleteFile CStr(sFullFileName)

'clear variables
set objBinaryFile = nothing
set FSO = nothing
set objCSpace = nothing



<table id=TblBottomBanner width="100%" bgcolor=lightgrey>
    <tr height="63" style="HEIGHT: 63px">
      <P align=center><STRONG>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp; All rights
      registered 2004 Nissan Europe</STRONG></P>
      <td width="80" style="WIDTH: 80px">
      <button id="cmdDoBack" style="WIDTH: 80px" class="StdButton" onclick="DoBack();">Back

<form id="frmMain" name="frmMain" method="post">
<input id="txtUserID" name="txtUserID" type=hidden value="<%=strUserID%>">


<script language=javascript>

// DoBack()
// ~~~~~~~~~~~~~~~
function DoBack()

   Navigate(frmMain, "MainMenu.asp");




Similar Threads
Thread Thread Starter Forum Replies Last Post
Office Web Components kalebson Access 1 July 16th, 2006 02:13 PM
Microsoft Office Web Components 9.0 (0x800A03EC) rekha_jsr Classic ASP Components 1 February 4th, 2006 08:19 PM
Embedding Office Web Components form JSP sunildath_019 JSP Basics 0 March 17th, 2004 06:11 AM
office web components with asp kathryne Classic ASP Professional 1 September 29th, 2003 08:50 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.