Skip to Content
0
Former Member
Feb 11, 2009 at 10:45 PM

InProc RAS Issue

61 Views

Hi All,

Maybe you all can help me. I'm working on a project where all information about fields on a Report are stored in a database. The includes Control Name, Left, Top, Width, Height, Value, Font Name, Font Size, Bold, and Italics. Also is a background image path and a fixed image size.

What I am doing is adding the image to the report, then adding each field and setting its properties. Code for adding each is below.

Language: VB .NET 2005

CR Version: XI R2 SP2 or later

IDE: Visual Studio .NET 2005

The issue is that when displayed the report is the wrong size (not 8.5x11.5) and the image is not the specified size. When text objects are added to the report it comes back with a "Invalid Field Name" on a report in a temp folder. Any ideas what I'm doing wrong or a better method?

Dim oRASDoc As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument = Nothing
Dim oPic As CrystalDecisions.ReportAppServer.ReportDefModel.PictureObject = Nothing
Dim oRASSection As CrystalDecisions.ReportAppServer.ReportDefModel.Section = Nothing
Dim oRepObject As CrystalDecisions.CrystalReports.Engine.ReportObject = Nothing

oRASDoc = oReportLetterTemplate.ReportClientDocument
oRASSection = oRASDoc.ReportDefController.ReportDefinition.FindSectionByName(oReportLetterTemplate.ReportDefinition.Sections(2).Name)

oPic = oRASDoc.ReportDefController.ReportObjectController.ImportPicture(sPictureFileName, oRASSection, 0, 0)
oPic.Width = 11520
oPic.Height = 14880

For Each oIcom In oArr
    iCount += 1
    oText = New CrystalDecisions.ReportAppServer.ReportDefModel.TextObject
    oText.Name = "TextObject" & iCount.ToString("000")
    oText.FontColor = New CrystalDecisions.ReportAppServer.ReportDefModel.FontColor
    oText.FontColor.Font.Name = oIcom.xFontName
    oText.FontColor.Font.Size = oIcom.xFontSize
    oText.FontColor.Font.Bold = oIcom.xFontBold
    oText.FontColor.Font.Italic = oIcom.xFontItalic

    If oText.Width + oIcom.xWidth < 60 OrElse oText.Height + oIcom.xHeight < 60 Then
        oText.Format.EnableSuppress = True
        oText.Width = 0
        oText.Height = 0

    Else
        oText.Width += oIcom.xWidth
        oText.Height += oIcom.xHeight
    End If

    oText.Top = oIcom.xTop
    oText.Left = oIcom.xLeft

    oRASSection.ReportObjects.Add(oText)

    oRepObject = oReportLetterTemplate.ReportDefinition.ReportObjects(oText.Name)
    If oRepObject.Kind = CrystalDecisions.Shared.ReportObjectKind.TextObject Then
         DirectCast(oRepObject, CrystalDecisions.CrystalReports.Engine.TextObject).Text = oIcom.xText
    End If
Next