In order to create the add-in, I just needed to send SXP, Create the out-of-the-box form with the report viewer, and show it (well, it might be a bit more). And here is the code:
' This class should be visible to COM
Public Class W6CustomReportAddin
Public Function DoAddIn( _
ByRef objCallingApp As Object, _
ByRef objCallingDoc As Object, _
ByRef lDocType As Integer, _
ByRef varSelectedEngineers As Object, _
ByRef varSelectedTasks As Object, _
ByRef varSelectedAssignments As Object) _
As Boolean
Try
' Send SXP request and get the response
Dim request As Xml.XmlDocument = _
New Xml.XmlDocument
request.LoadXml( _
"<SXPServerReportProcess><Report>" & _
"<Name>Custom Report</Name>" & _
"</Report></SXPServerReportProcess>")
Dim conn As W6Logon.Connection = _
New W6Logon.Connection
Dim response As Xml.XmlDocument = _
conn.Send(request)
' Create the report viewer dialog and set
' the report properties
Dim dialog As W6ReportsClient.frmMainForm = _
New W6ReportsClient.frmMainForm( _
W6ReportsClient.ProductType.ClickSchedule)
Dim dataManager As _
W6ReportsClient.CW6DataManager = _
W6ReportsClient.CW6DataManager.GetInstance()
dialog.ReportsServerURL = _
dataManager.ReportServerURL
dialog.ReportPath = "/" & _
dataManager.RootFolder & "/" & _
dataManager.ClickScheduleFolderName & _
"/Day/Custom Report"
' Create client domain and set the instance id
Dim domain As _
W6ReportsClient.CW6ClientDomain = _
New W6ReportsClient.CW6ClientDomain( _
W6ReportsClient.ProductType.ClickSchedule)
domain.InstanceID = _
response.DocumentElement.SelectSingleNode( _
"InstanceID").InnerText
' Set the title and build the report
dialog.AddReportNameToTitle("Custom Report")
dialog.BuildReport(domain)
' Show the dialog as modal form
dialog.ShowDialog()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly, "Error")
End Try
End Function
End Class
No comments:
Post a Comment
Please keep comments clean at the ClickDev blog.