![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Using DOORS with Excel. Topic Summary: I am able to insert values in excel sheet but has anyone used calling chart through DXL code? Created On: 8-Jun-2006 07:40 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
||||||||||||||||||||||||||||||
Hi,
I have been successful in writing in Excel using DXL. I am not able to create a chart with DXL. How to use the Excel Function SetSourceData(). I am attaching the source code along this message in zipped format. Can someone help me please? Thanks in Advance, Amit |
||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
Sorry wasnt able to attach the source code before so am attaching it in this message.
|
||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
Hi Amit,
you can use it like the example in attached code .... hope that helps you ![]() Greetings Reik Schröder ------------------------- Evosoft GmbH for Siemens Industry Sector Berlin, Germany Edited: 8-Jun-2006 at 11:32 by Reik Schroeder |
||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
![]() |
||||||||||||||||||||||||||||||
I tried that Reik, it is not working. Here is the problem explained better: I have 2 pieces of code one in Dot net and other in DXL. ffice The line marked in Red is the problem area in DXL code The Part 3 gives the signature of the excel function which needs to be called. Part 4 gives the error message I am getting My problem is I am not able to pass correct parameter to the setSourceData function.. PART 1: Here is a part of dot net code which created Excel chart Dim objXL As Object Dim objBook As Object Dim objSheet As Object Dim objChart As Object Dim iRow As Integer Dim iCol As Integer ' Number of points in each Series Const cNumCols = 10 'Number of Series Const cNumRows = 2 'Declare the required size of the dynamic array Dim aTemp(cNumRows, cNumCols) 'Start Excel and create a new workbook objXL = CreateObject("Excel.application") objBook = objXL.Workbooks.Add 'Set a reference to Sheet1 objSheet = objBook.Worksheets.Item(1) ' Insert Random data into Cells for the two Series: Randomize(Now().ToOADate()) For iRow = 1 To cNumRows For iCol = 1 To cNumCols aTemp(iRow, iCol) = Int(Rnd() * 50) + 1 Next iCol Next iRow objSheet.Range("A1").Resize(cNumRows, cNumCols).Value = aTemp ' Add a chart object to the first worksheet objChart = objSheet.ChartObjects.Add(50, 40, 300, 200).Chart objChart.SetSourceData(Source:=objSheet.Range("A1:J2")) '//.Resize(cNumRows, cNumCols)) ' Make Excel Visible: objXL.Visible = True objXL.UserControl = True PART 2 When I try to do the equivalent in DXL, The code below has a few functions which are written by me and I haven't put it here as it would be too lengthy. OleAutoObj objChartObject OleAutoObj objChart OleAutoObj objNewChart=null OleAutoObj objRangeObj oleResult( oleGet( objExcelDataExportSheet, "ChartObjects", objChartObject),cExcelChartObject) // here objExcelDataExportSheet is the excel sheet. if ( null objChartObject) { ack "Error while getting the chart object." } clear( objArgBlock ) put( objArgBlock, 150) put( objArgBlock, 15) put( objArgBlock, 300) put( objArgBlock, 200) oleResult( oleGet( objChartObject, "Add", objArgBlock,objChart),cExcelMethodAdd) if ( null objChart) { ack "Error while Setting Add Method." } string range = "A2:" getExcelColumnAlphaAddressFromInt( 2) ( iRowsCount ) "" objRangeObj = excelGetCellOLE(objExcelDataExportSheet,range) if(null objRangeObj ) ack "Excel Chart - Range NULL " oleMethod (objRangeObj, "Select") clear( objArgBlock ) put( objArgBlock,objRangeObj) oleMethod temp = oleResult( oleMethod( objChart, "SetSourceData", objArgBlock),cExcelSetSource) if ( null objChart) { ack "Error while Setting Add Method." } PART 3
|