none
trouble in show report with reportviewer RRS feed

  • Question

  • I have some trouble with report viewer. I am designing a report inrdlc file. Report size is A4(29.7x21cm: Landscape). Report body height is 15cm and store a table that can be shown 15 rows per page with each row height is 1cm. all textbox in table I set CanGrow property is false, Can Shrink property is false.
        It is mean that the table is fixed and fit 15 rows per page even the data in each textbox are larger or smaller then textbox width and height.
        But It have some problem when it is shown. I added some picture about this...
        Someone can  help me  ????
    Thursday, January 10, 2008 6:53 AM

All replies

  • Jerry, your picture isn't showing.  Can you provide a URL for where you have posted your picture, or can you describe in words, please?

     

    >L<

     

    Monday, January 14, 2008 1:56 AM
  • oh, I'm sorry . I dont know how to post pic  in here ....
    I am trying ....
    pic Error:
    http://flickr.com/photos/22647800@N05/2181890423/
    http://flickr.com/photos/22647800@N05/2181891529/

    pic good:
    http://flickr.com/photos/22647800@N05/2182676924/

    Please help me with this trouble... I set size for this report is 29.7x21cm but it appear as not my expect
    Wednesday, January 16, 2008 8:54 AM
  • OK I have some questions...

     

    1) http://flickr.com/photo_zoom.gne?id=2181891529&size=o  is "almost" right, correct?  Except that the bottom is cut off?  In this report example does the bottom row have additional content that is pushed to the next page?

     

    2) in http://flickr.com/photo_zoom.gne?id=2182676924&size=o, the "good" report, why are rows not in alternating colors (why are two adjacent rows both grey background)?

     

    3) look at the length of the captions in Asian characters in the second column (counting from left), in the "good" and "bad" versions. It looks like the issue is more obvious when this caption is wider.  How are the textboxes set up for this column, have put put multiple expressions with space padding in between, or what?

     

    4) Are the columns for the numbers wide enough for what you are putting in them? look at the difference between the numbers in the "good" report and the numbers in the "worst" report (http://flickr.com/photo_zoom.gne?id=2181890423&size=o) (counting from left); the numbers in the "bad" version are wide in the top row but narrow in the "good" version in the top row.  For example, the "bad" version has values like this:

     

    Code Block


       bad report cells:                       good report cells:

                 2,800                                       0

                     0                                  42,000

     

     

    ... so I have to ask again: did you use spacing and maybe vbCR's to push content to the next line?  What is the direction (LTR, RTL) and alignment of these cells?

     

    5) are these images from the PDF version, the interactive version, or what?  If the interactive version, how have you set interactive height and width?

     

    6) what are the padding values of these textboxes ?

     

    7) Have you used any visibility settings?

     

    >L<

    Wednesday, January 16, 2008 3:53 PM
  • thanks Lisa Nicholls for your consider. I already solved this problem ...
    But I have another thing. Could you see the color of row.. I doesnt look like white-Gray continuously because there have been 4 grouping in the table.So, I dont know how to paint it as I want .... Somebody can help me this ....
    thanks
    Cheers.

    Tuesday, January 22, 2008 6:39 AM
  • You can set the background color and the border color for a row, yes.  What seems to be the problem?

     

    >L<

     

    Tuesday, January 22, 2008 8:33 AM
  • Smile I want to set background color as
    row 1 : white
    row 2 : grey
    row 3 : white
    row 4 : grey
    ...

    but in my report, it have 4 group in a table, so I cant set the background that use "RowNumber Mod 2 = 0 " or something like that.
    Can you have any idea for that ?????
    Tuesday, January 22, 2008 9:25 AM
  • >>but in my report, it have 4 group in a table, so I cant set the background that use "RowNumber Mod 2 = 0 "

     

    Sure you can.  You need to use the scope argument of the RowNumber function, however.  Scope the function to the groiup on which you want to base the alternation of color.  For example, if I have a table with a group named "table1_SalesPerson" I can do this:

     

    Code Block


    =IIF(RowNumber(
    "table1_SalesPerson")
        
    mod 2 = 0,"White","Gray")

     

     

     

    >L<

    Tuesday, January 22, 2008 4:10 PM
  • Ok, it can use in case that have no group . Because RowNumber("table1_Group1")  will return a total row in that group.
    The returned value of RowNumber in group is not continuous with returned value of RowNumber in Detail.....
    So we could not use
               IIF(RowNumber(
    "table1_SalesPerson") mod 2 = 0,"White","Gray")
          for paint color of background if we have more than 1 group
     Do you have any idea for that ????
    Wednesday, January 23, 2008 2:45 AM
  • I'm sorry, I guess I don't understand what you want.  You mean you want the group rows also to be in these different colors, without marking them out as *different* (group headers and footers) in any way?

     

    I guess you could do that.  How many group header rows do you have, in total?  And which group level are you trying to scope on ?

     

    I would feel better if you showed a picture of what you are trying to do.

     

    >L<

     

    Wednesday, January 23, 2008 2:49 AM
  • Ok, I posted some picture to describe my question....
    pic in Design Mode : http://www.flickr.com/photos/22647800@N05/2213849476/
    pic in Running  Mode : http://www.flickr.com/photos/22647800@N05/2213055059/
                                      http://www.flickr.com/photos/22647800@N05/2213054865/


    I have commented in the picture and what I want it be, and I have 1 picture in Design mode ,
    In design mode, You can see I have 5 group. so , How can I set background color of table (all row even it is a row in group) in report as :
                       White
                       Grey
                       White
                       Grey
                        . . . .


    Smile


    Wednesday, January 23, 2008 4:33 AM
  • Jerry,  you *can* do exactly what you want (I am not sure why you don't want to distinguish the group headers, but it is do-able). 

     

    Thank you for providing an example (picture) so I know what to tell you .  Here you go:

     

    1. Make the BackgroundColor for the first textbox in each row the following expression:

     

    Code Snippet

     

    =Code.GetRowColor(True)

     

     

    2. For all other textboxes in each row, use the following expression for the BackgroundColor:

     

    Code Snippet


    =Code.GetRowColor(False)

     

     

    3. And in your Report Code, put the following code:

     

    Code Snippet

    Dim iRow AS Integer = 0

     

    Public Function GetRowColor(tIncr AS Boolean) AS String

      If tIncr Then
        iRow= iRow + 1
      End If


      If iRow Mod 2 = 0 Then
         Return "Gray"
      Else
         Return "White"
      End If

    End Function

     

     

    ... Not that tough, is it <s>?

     

    >L<

    Wednesday, January 23, 2008 6:54 AM
  • Thanks  Lisa
    I have changed some code like this:

    Code Snippet
    Dim iRow AS Integer = 0

    Public Function GetRowColor(tIncr AS Boolean) AS Integer
      If tIncr Then
        iRow= iRow + 1
      End If
      return iRow
    End Function


    to return the index of row.
    and  I added 1 column to my report to show row index....and the value of textbox in this column is
            =Code.GetRowColor(True)

    pic : http://www.flickr.com/photos/22647800@N05/2214160456/

    In picture, You can see the value ..... The value detail is right but in Group is wrong .....
    how is it ???
    Another thing , Can we debug code in report ????














    Wednesday, January 23, 2008 7:54 AM
  • Jerry it isn't going to work that way, I don't think.  Did you try it the way I suggested? Because that way does work.

     

    Yes you can debug code in report, sort of.  What exactly are you looking for?  This is a rather large subject <s>.

     

    >L<

    Wednesday, January 23, 2008 5:58 PM
  • Yes, I did exactly as your suggested. I already did something the same as that before and the result is the same ... so, that why I opened this thread to discuss and get advise about this. I dont know why ....but I think it goes right
            
             1    Group 1: header

             2            Group 2: header                     

             3                    Group 3: header

             4                            Detail

             5                            Detail

             3                    Group 3: footer

             2            Group 2: footer

             1    Group 1: footer

         I image it ran like that ....

       Can you show me how to debug the code in custom code of report. I want to know how the code goes on. Maybe I can find out what going on by that way ....

        Smile

    Thursday, January 24, 2008 3:09 AM
  • Jerry, if you take a look at the pictures you posted, you will see (I hope) why I could not tell that you had group footers <sigh>. I honestly do not see them.  

     

     I don't know if that makes a difference or not.  I can try it in my sample report, which I created with 5 groups, using group headers and detail rows ** because I thought that was how you had defined your report **.  And I swear I got exactly the right result.  So either you did something that was not "exactly the same" or footers make a difference.

     

    By saying "I want to know how the code goes on" as your definition of "how to debug the code in custom code of report" I *think* you mean that you want to follow the order of execution.  Is that what you want to do?

     

    If it is, I describe a technique that you can use for this purpose (and that I have often used for this purpose) here:

     

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1807270&SiteID=1

     

    ... in that thread I'm using it for a completely different purpose, but (as discussed here http://spacefold.com/lisa/post/Reset-On-Group-(Page-X-of-XX-in-a-group%2c-within-a-total-Y-of-YY-for-the-report)%2c-SQL-Reporting-Services-Style-.aspx) it happens to be really great for examining order-of-execution.

     

    The basic idea is to instrument your custom code so that it writes to a file during the report run.

     

    You should be able to adapt it for your purpose.

     

    As for your colors problem... I don't have the sample report on this machine and don't have time to recreate it right now, but I will try it out with footers later when I have a chance.  I think what I wrote for you should still work. 

     

    >L<

    Thursday, January 24, 2008 4:50 AM
  • Thanks for all, Lisa
    It is right, Your code is right when group is in header area ... but my one place in footer Sad
    I will try with your advise ... (sorry for my poor english .. I could not describe exactly in English but you did good, you'd  given me what I want Smile, thank you  )

    Nice to talk to you ....
     
    Smile
    Thursday, January 24, 2008 7:31 AM
  • Hi Jerry,

     

    I am back with my sample report now, so I was able to try and see that you can't use the technique I posted with a group footer.  I bet if you have instrumented your report code as I suggested you will be able to see this.

     

    But there might be a way around it.  In the Group footer you would not increment the row number and it would take some pretty fancy logic, but it might work.

     

    I'm not sure how to explain this or give you the exact logic, because it would depend on exactly the groups that had footers and how many footer lines each such group had.    But in some cases it would be do-able.

     

    In my preliminary tests I was able to get the correct row # in a single footer line by doing something like this:

     

    * -- in the innermost group header, rather than just incrementing in the first textbox in the row, I did this:

     

    Code Snippet


    =Code.GetRowColor(True, CountRows("Group5"))

     

     

     

    * -- I added another variable and some additional code in the function:

     

    Code Snippet

    Public iInnerGroupRows AS Integer = 0

     

    Public Function GetRowColor( _
              Optional tIncr AS Boolean  = False, _
              Optional tInnerGroupRows AS Integer = 0, _
              Optional tIsFooter As Boolean = False, _
              Optional tAddToFooter As Integer = 0) AS String
     If tIncr Then
        iRow= iRow + 1
     End If
    If tInnerGroupRows > 0 Then
       ' what is the "real" row number for use in the footer?
       ' figure this out in the innermost header
       iInnerGroupRows = iRow + tInnerGroupRows
    End If
    If tIsFooter Then
       If ( iInnerGroupRows + tAddToFooter) MOD 2 = 0  Then
          Return"Gray"
       Else  
          Return"White"
       End If
    Else IF (iRow ) MOD 2 = 0 Then
       Return"Gray"
    Else
       Return "White"
    End If

    End Function

     

     

    * -- I checked this in the footer, it was consistently correct.  BTW you don't have to return the value from the function, I just put =Code.iInnerGroupRows in a textbox in the footer to check it.

     

    * -- in EACH textbox in the footer line (not just the first one in the row) I used this expression:

     

    Code Snippet


    =Code.GetRowColor(False,0,True,1)

     

     

    ... so that, instead of incrementing, I'm saying "take the last detail line and add to it what number footer row I'm in", in this case 1.

     

    ... so far so good.  Now we're left with offsetting the next set of group headers by the number of footer lines that have preceded it.  I think with some more arguments and more work it would be possible to do this... but again it would be different for each case and frankly I'm not motivated enough <g>.

     

    I think it might make *more* sense to fake the footer rows somehow using an expression such as IF CountRows("GroupX") = RowNumber("GroupX") in a detail row to figure out if we were on the last row.

     

    >L<

     

     

     

     

     

    Saturday, January 26, 2008 6:21 PM
  • Hi Lisa, I tried your newest suggested ... but maybe I place the code at wrong place .. so it doesnt work right way ... Can you tell me how to add  the code,please ...

    * Group 5 header line :
      * Group 4 header line :
        * Group 3 header line : 
          * Group 2 header line : 
            * Group 1 header line:
    * Detail line:
           _ First textbox : =Code.GetRowColor(True, CountRows("table1")
           _ all textbox except the first one : =Code.GetRowColor(False)
            * Group 1 footer line: =Code.GetRowColor(False,CountRows("table1_Group1"),True,1)
          * Group 2 footer line :  =Code.GetRowColor(False,CountRows("table1_Group2"),True,2)
        * Group 3 footer line :  =Code.GetRowColor(False,CountRows("table1_Group3"),True,3)
      * Group 4 footer line :  =Code.GetRowColor(False,CountRows("table1_Group4"),True,4)
    * Group 5 footer line :  =Code.GetRowColor(False,CountRows("table1_Group5"),True,5)


    Is that something wrong ???
    Monday, January 28, 2008 7:59 AM