Dynamic Property changes in Crystal Report Using

Posted on 2007-10-04
Last Modified: 2012-06-27
Ihave a problem in crystal report .i hv 5 to 6 subreports in Main report.and i adjust their height and width.and some time one of the subreport do not show any result and due to that reason their is gap between subreports.i try to access the crystal report objects programmicaticlly and i succeed in accessing the normal objects like Text Box through this line of code. crp.ReportDefinition.Sections("ReportHeaderSection1").ReportObjects.Item("Text2").Left = 8000 This line work and i m able to change its left ,width and etc. but when i access the cross tab or subreport through the same line of code crp.ReportDefinition.Sections("ReportHeaderSection1").ReportObjects.Item("Crosstab").Left = 8000 i get arror message Add or chnage this type of Report Object is not allowed. Kindly help me in that Regard.I am waiting
Question by:Yogeshup
    LVL 100

    Expert Comment

    You can suppress blank subreports or blank sections to avoid the blank areas.

    Try using CrossTab1

    You can use the Report explorer to find the names of the report objects.

    LVL 42

    Expert Comment

    Agree - use the built in Crystal functionality to suppress if blank rather than mucking around with properties externally while the report is rendering.  You will get much better results that way!

    LVL 1

    Author Comment

    seems like i have not put up the question properly.  Very sorry about that.

    I have a main report which consists of several sub-reports in different sections.  I have designed the sub-reports and the main report in portrait (paper orientation).  My requirement is that based on the user selection (ie. Portrait / Landscape), the report should be generated in the respective orientation.  I am able to change the position or size of the textobject placed in the main report by using the code

    crDocument..ReportDefinition.ReportObjects.Item("TemplateName2").Left = 12000
    crDodcument.Width = 15000

    Also, the report is getting generated properly in the screen based on the paper orientation selected by the user.  

    The problem is that when I export the report in PDF, the sub-report part (which includes cross-tab) gets printed as per portrait (ie. gets cut).  Looks like cross-tab exports based on portrait orientation.  

    Hope the question is clear now.   Would really appreciate help on this one.

    Thanks is advance.
    LVL 100

    Accepted Solution

    Crystal doesn't handle changes like that very easily.

    A better idea might be to have 2 reports.  Identical except for orientation.

    LVL 42

    Assisted Solution

    I saw one discussion of a very similar sounding problem that was fixed by a service pack - I believe it was on XIr2.  If you haven't already done so, you should apply any outstanding service packs to see if that helps.

    I agree with mlmcc though - if a service pack doesn't fix it, it's unlikely to be workable and you may need to take the alternate approach of two different reports.

    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now