This is a migrated thread and some comments may be shown as answers.

Converting Reporting Tool to 2012 Q1

4 Answers 134 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rich
Top achievements
Rank 1
Rich asked on 06 Aug 2012, 05:56 PM
I have inherited an application that was using a old version of the reporting tool.
Good news: I've gotten the above version installed on my machine (where none was installed previously).
Bad news: I got a number of compile errors now and I really haven't found anywhere to go where I can figure out what the code was/is doing.

I have made some changes to other methods (SWAGS trust me), but NO changes here.  Here is the method that is currently causing me headaches, although I'm sure there is more coming:

 

 

 

    Private Sub DetailSection1_ItemDataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailSection1.ItemDataBound
        Dim section As Processing.DetailSection = TryCast(sender, Processing.DetailSection)
        Dim typeText As Processing.ReportItemBase = section.Items.Find("txtType", False)(0)
        Dim mfgText As Processing.ReportItemBase = section.Items.Find("txtMFG", False)(0)
        Dim catalogText As Processing.ReportItemBase = section.Items.Find("txtCatalog", False)(0)
        Dim qtyText As Processing.ReportItemBase = section.Items.Find("txtQty", False)(0)
        Dim leadTimeText As Processing.ReportItemBase = section.Items.Find("txtLeadTime", False)(0)
        Dim notesText As Processing.ReportItemBase = section.Items.Find("txtNotes", False)(0)

        Dim row As DataRowView = TryCast(section.DataItem, DataRowView)
        If row IsNot Nothing Then
            Dim val As Object = row.Row("LINE_TYPE")
            If Not (TypeOf val Is DBNull) AndAlso _
              val.ToString.ToUpper = "GRP" Then
                typeText.Visible = False
                mfgText.Visible = False
                catalogText.Style.Font.Bold = True
               
            End If
        End If

    End Sub

Any help will be greatly appreciated!

Rich

 

 

4 Answers, 1 is accepted

Sort by
0
Rich
Top achievements
Rank 1
answered on 07 Aug 2012, 11:56 AM
Well, I've managed to get the references to the textboxes...I think.  Since I haven't had any luck with defining the row object I can't test yet.  Here is the current version:
       Dim section As Processing.DetailSection = TryCast(sender, Processing.DetailSection)
        Dim typeText As Processing.TextBox = DirectCast(section.ChildElements.Item("txtType"), Processing.TextBox)
        Dim mfgText As Processing.TextBox = DirectCast(section.ChildElements.Item("mfgText"), Processing.TextBox)
        Dim catalogText As Processing.TextBox = DirectCast(section.ChildElements.Item("catalogText"), Processing.TextBox)
        Dim qtyText As Processing.TextBox = DirectCast(section.ChildElements.Item("qtyText"), Processing.TextBox)
        Dim leadTimeText As Processing.TextBox = DirectCast(section.ChildElements.Item("leadTimeText"), Processing.TextBox)
        Dim notesText As Processing.TextBox = DirectCast(section.ChildElements.Item("notesText"), Processing.TextBox)

        Dim row As DataRowView = TryCast(section.ChildElements.Item, DataRowView)
        If row IsNot Nothing Then
            Dim val As Object = row.Row("LINE_TYPE")
            If Not (TypeOf val Is DBNull) AndAlso _
              val.ToString.ToUpper = "GRP" Then
                typeText.Visible = False
                mfgText.Visible = False
                catalogText.Style.Font.Bold = True
                
            End If
        End If

The bold line is the problem at this point.  If anyone has any idea on how to fix that one, I'd sure appreciate it.

Thanks!

Rich
0
Peter
Telerik team
answered on 08 Aug 2012, 09:06 AM
Hi Rich,

The code you have shared is obsolete, in Q2 2012 we have introduced the following changes:

  • CHANGE: Telerik.Reporting.Processing.ProcessingElement.ChildElements property is now obsolete. Use Telerik.Reporting.Processing.ElementTreeHelper.GetChildElements() method instead.
  • CHANGE: Telerik.Reporting.Processing.ProcessingElement.Parent is now obsolete. Use Telerik.Reporting.Processing.LayoutElement.ParentElement instead.
  • CHANGE: Telerik.Reporting.Processing.ReportItemBase.DataObject property is moved to the base type Telerik.Reporting.Processing.ProcessingElement
  • CHANGE: Telerik.Reporting.Processing.ProcessingElement.Style property is moved to the base type Telerik.Reporting.Processing.VisualElement
  • CHANGE: Telerik.Reporting.Processing.ProcessingElement.Visible property is moved to the base type Telerik.Reporting.Processing.VisualElement
Generally when possible we highly recommend to avoid report events. In the current case you can utilize conditional formatting or bindings with the following expressions:
=Fields.LINE_TYPE = "GRP"
=Fields.LINE_TYPE <> "GRP" 

If you still want to use report events, check out the Using Section Events help article.

All the best,
Peter
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

0
Rich
Top achievements
Rank 1
answered on 08 Aug 2012, 02:30 PM

I have managed to get the 2012 Q2 version installed, and all of the references updated...I think.  It at least compiles at this point which is better than yesterday.

The bad news is that the code continues to produce nothing on the "report" (which is nothing but a cover page for a document) except the current date.  Here is the Cover page definition code, and the code behind that manipulates the data.  This was all originally written for the 2008 Q3 reporting tool.

Can anyone see why there is only the date being put on the page?

THANKS!

Public Class CoverPage
    Inherits Telerik.Reporting.Report
    Friend WithEvents PageHeaderSection1 As Telerik.Reporting.PageHeaderSection
    Friend WithEvents DetailSection1 As Telerik.Reporting.DetailSection
    Private WithEvents pictureBox1 As Telerik.Reporting.PictureBox
    Private WithEvents textBox1 As Telerik.Reporting.TextBox
    Private WithEvents textBox8 As Telerik.Reporting.TextBox
    Private WithEvents textBox9 As Telerik.Reporting.TextBox
    Private WithEvents textBox10 As Telerik.Reporting.TextBox
    Private WithEvents textBox2 As Telerik.Reporting.TextBox
    Friend WithEvents PageFooterSection1 As Telerik.Reporting.PageFooterSection
  
    Public Sub New()
        InitializeComponent()
  
    End Sub
  
    'NOTE: The following procedure is required by the telerik Reporting Designer
    'It can be modified using the telerik Reporting Designer.  
    'Do not modify it using the code editor.
    Private Sub InitializeComponent()
        Me.PageHeaderSection1 = New Telerik.Reporting.PageHeaderSection()
        Me.pictureBox1 = New Telerik.Reporting.PictureBox()
        Me.textBox1 = New Telerik.Reporting.TextBox()
        Me.textBox8 = New Telerik.Reporting.TextBox()
        Me.textBox9 = New Telerik.Reporting.TextBox()
        Me.textBox10 = New Telerik.Reporting.TextBox()
        Me.textBox2 = New Telerik.Reporting.TextBox()
        Me.DetailSection1 = New Telerik.Reporting.DetailSection()
        Me.PageFooterSection1 = New Telerik.Reporting.PageFooterSection()
        CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
        '
        'PageHeaderSection1
        '
        Me.PageHeaderSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(8.7895841598510742R)
        Me.PageHeaderSection1.Items.AddRange(New Telerik.Reporting.ReportItemBase() {Me.pictureBox1, Me.textBox1, Me.textBox8, Me.textBox9, Me.textBox10, Me.textBox2})
        Me.PageHeaderSection1.Name = "PageHeaderSection1"
        '
        'pictureBox1
        '
        Me.pictureBox1.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.010456085205078125R), Telerik.Reporting.Drawing.Unit.Inch(0.010456006042659283R))
        Me.pictureBox1.MimeType = ""
        Me.pictureBox1.Name = "pictureBox1"
        Me.pictureBox1.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(2.9791271686553955R), Telerik.Reporting.Drawing.Unit.Inch(1.9791272878646851R))
        Me.pictureBox1.Sizing = Telerik.Reporting.Drawing.ImageSizeMode.ScaleProportional
        Me.pictureBox1.Value = "=Fields.LOGO"
        '
        'textBox1
        '
        Me.textBox1.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.0062500634230673313R), Telerik.Reporting.Drawing.Unit.Inch(2.5R))
        Me.textBox1.Name = "textBox1"
        Me.textBox1.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4728379249572754R), Telerik.Reporting.Drawing.Unit.Inch(0.38958358764648438R))
        Me.textBox1.Style.Font.Size = Telerik.Reporting.Drawing.Unit.Point(20.0R)
        Me.textBox1.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center
        Me.textBox1.Value = "=Fields.JOB_NAME"
        '
        'textBox8
        '
        Me.textBox8.Format = "{0:d}"
        Me.textBox8.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.0R), Telerik.Reporting.Drawing.Unit.Inch(3.1314079761505127R))
        Me.textBox8.Name = "textBox8"
        Me.textBox8.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4790878295898437R), Telerik.Reporting.Drawing.Unit.Inch(0.20000004768371582R))
        Me.textBox8.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center
        Me.textBox8.Value = "=Now()"
        '
        'textBox9
        '
        Me.textBox9.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.0R), Telerik.Reporting.Drawing.Unit.Inch(2.9104957580566406R))
        Me.textBox9.Name = "textBox9"
        Me.textBox9.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4790878295898437R), Telerik.Reporting.Drawing.Unit.Inch(0.20000004768371582R))
        Me.textBox9.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center
        Me.textBox9.Value = "=Fields.PROJECT_NUMBER"
        '
        'textBox10
        '
        Me.textBox10.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(3.5104167461395264R), Telerik.Reporting.Drawing.Unit.Inch(0.010456045158207417R))
        Me.textBox10.Name = "textBox10"
        Me.textBox10.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(2.9686708450317383R), Telerik.Reporting.Drawing.Unit.Inch(0.20000004768371582R))
        Me.textBox10.Value = "=Fields.ENTIRE_ADDR"
        '
        'textBox2
        '
        Me.textBox2.Location = New Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.031368255615234375R), Telerik.Reporting.Drawing.Unit.Inch(6.0208334922790527R))
        Me.textBox2.Name = "textBox2"
        Me.textBox2.Size = New Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4686317443847656R), Telerik.Reporting.Drawing.Unit.Inch(2.7687110900878906R))
        Me.textBox2.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Bottom
        Me.textBox2.Value = "=Fields.COVER_PAGE_TEXT"
        '
        'DetailSection1
        '
        Me.DetailSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(0.0520833320915699R)
        Me.DetailSection1.Name = "DetailSection1"
        '
        'PageFooterSection1
        '
        Me.PageFooterSection1.Height = Telerik.Reporting.Drawing.Unit.Inch(0.0520833320915699R)
        Me.PageFooterSection1.Name = "PageFooterSection1"
        '
        'CoverPage
        '
        Me.Items.AddRange(New Telerik.Reporting.ReportItemBase() {Me.PageHeaderSection1, Me.DetailSection1, Me.PageFooterSection1})
        Me.Name = "CoverPage"
        Me.PageSettings.Landscape = False
        Me.PageSettings.Margins.Bottom = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.Margins.Left = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.Margins.Right = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.Margins.Top = Telerik.Reporting.Drawing.Unit.Inch(1.0R)
        Me.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter
        Me.Style.BackgroundColor = System.Drawing.Color.White
        Me.Width = Telerik.Reporting.Drawing.Unit.Inch(6.5R)
        CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
  
    End Sub
  
  
Private Sub CreateCoverPage(ByVal submittalID As Decimal, ByVal doc As PDFDocument)
  
        Dim cvr As New CoverPage
  
        Dim dtCover As doSubmittal.CoverPageDataTable
        Using rpt As New boSubmittal
            dtCover = rpt.CoverPage_GetBySubmittalID(submittalID)
        End Using
        Dim dr As doSubmittal.CoverPageRow = dtCover(0)
  
        dr.ENTIRE_ADDR = String.Empty
        If Not dr.IsREP_NAMENull Then dr.ENTIRE_ADDR &= dr.REP_NAME & vbCrLf
        If Not dr.IsADDR_LINE_1Null AndAlso Not String.IsNullOrEmpty(dr.ADDR_LINE_1.Trim) Then dr.ENTIRE_ADDR &= dr.ADDR_LINE_1 & vbCrLf
        If Not dr.IsADDR_LINE_2Null AndAlso Not String.IsNullOrEmpty(dr.ADDR_LINE_2.Trim) Then dr.ENTIRE_ADDR &= dr.ADDR_LINE_2 & vbCrLf
        If Not dr.IsADDR_LINE_3Null AndAlso Not String.IsNullOrEmpty(dr.ADDR_LINE_3.Trim) Then dr.ENTIRE_ADDR &= dr.ADDR_LINE_3 & vbCrLf
        If Not dr.IsCITYSTATEZIPNull Then dr.ENTIRE_ADDR &= dr.CITYSTATEZIP & vbCrLf
        If Not dr.IsPHONE_NUMBERNull Then dr.ENTIRE_ADDR &= "Phone: " & dr.PHONE_NUMBER & vbCrLf
        If Not dr.IsFAX_NUMBERNull Then dr.ENTIRE_ADDR &= "Fax: " & dr.FAX_NUMBER & vbCrLf
        If Not dr.IsREP_CONTACT_NAMENull Then dr.ENTIRE_ADDR &= "Contact: " & dr.REP_CONTACT_NAME & vbCrLf
  
        If Not dr.IsPRINT_CONTACTS_FLAGNull Then
            dr.ALL_CONTACTS = String.Empty
            Dim contacts = GetContacts(submittalID)
  
            dr.ALL_CONTACTS &= vbCrLf & "Submitted To: " & vbCrLf & contacts
  
        End If
  
        If Not dr.IsVERSION_NUMBERNull Then
            dr.PROJECT_NUMBER = dr.PROJECT_NUMBER & "-" & dr.VERSION_NUMBER
        End If
  
        Dim mimType As String = String.Empty
        Dim extension As String = String.Empty
        Dim encoding As Encoding = Nothing
  
        Dim rptProcessor As New Telerik.Reporting.Processing.ReportProcessor()
  
        Dim instanceReportSource As New Telerik.Reporting.InstanceReportSource()
        instanceReportSource.ReportDocument = cvr
        Dim result As Telerik.Reporting.Processing.RenderingResult = rptProcessor.RenderReport("PDF", instanceReportSource, Nothing)
  
        Dim fileName As String = result.DocumentName & ".pdf"
        Dim buffer As Byte() = result.DocumentBytes
  
        PDFFileEx.SerialNumber = _serialNumber
        Dim mctiFile As PDFFileEx = PDFFileEx.FromStream(New MemoryStream(buffer))
  
        Try
            ' extract the content 
            Dim ic As PDFImportedContent() = mctiFile.ExtractPagesContent()
  
            ' create the new document
            Dim pic As PDFImportedContent
            For Each pic In ic
                ' draw the imported content on the new page
                Dim page1 As PDFPage = doc.AddPage()
                page1.Canvas.DrawImportedContent(pic, 0, 0, page1.Width, page1.Height)
            Next
  
        Finally
            mctiFile.Close()
            mctiFile.Dispose()
            cvr.Dispose()
            dtCover.Dispose()
        End Try
  
  
    End Sub

0
Peter
Telerik team
answered on 10 Aug 2012, 10:11 AM
Hello Rich,

The report definition you have send us is not databound. This is why the report is blank. It seems that in the CreateCoverPage() method you create a datasource (dtCover). However it's never assigned to the Report.DataSource property.

For more information and examples check out the How to: Bind to a DataTable help article.

Regards,
Peter
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Rich
Top achievements
Rank 1
Answers by
Rich
Top achievements
Rank 1
Peter
Telerik team
Share this question
or