Ramona

Is there a way to calculate a row height from a table in rdlc file (reportviewer)


Re: Visual Studio Report Controls Row Height in table from rdlc file

Caddre

If you are using it in remote mode a SQL Server row is 8000 meaning 8bytes if you are not using the new Varchar(max), Nvarchar(max), Text and Ntext data types, if you are using it in local mode you may need to run some tests but I would think it will inherit the row from the controls you use to develop the report. The first link is SQL Server maximum capacity for features and the second covers all you will need to use the control including code samples for Winform and Webform. Hope this helps.

http://msdn2.microsoft.com/en-us/library/ms143432.aspx

http://www.gotreportviewer.com/






Re: Visual Studio Report Controls Row Height in table from rdlc file

Lisa Nicholls

While (I think) a table row does not have a height in the RDL, its contained controls do, and you could take the max of these. However, that would not account for CanGrow/CanShrink, row visibility, etc.


Ramona, are you doing this because you are still working on that scrollbar problem I don't think you are going to be able to calculate this very exactly...

>L<






Re: Visual Studio Report Controls Row Height in table from rdlc file

Ramona

Yes, for the scroll problem. I use InteractiveSize - height to obtain all records from a data set on 1page, and the row height (default is 0.25in) * number of records to obtain the height of reportviewer control (and scrollbar disappear). But when a change the font size and name in a cell of row the formula for reportviewer control height doesn't work (the scrollbar appear)

And my problem is that there is a way to calculate the row height when change the font size and name I know that the row have autosize.





Re: Visual Studio Report Controls Row Height in table from rdlc file

Lisa Nicholls

If I remember correctly, you are in winforms, yes

You can do a lot of work with text metrics through the System.Drawing namespace. I am not sure how exacting your formula is, but you could probably add in some of this to help gauge the difference the the font and size make, add whatever padding you have, etc.

Here is a reasonable example of some code that interrogates font properties

http://www.codeproject.com/csharp/drawing_text_strings.asp

... this is not exactly what you need to do but it's the first example I found in googling System.Drawing gdiplus text metric.

FWIW report controls have slightly different classes and properties to handle text but I don't think this should matter for your purposes. What you want to do is have a baseline value (such as .25 in) and know the height for the font on which that baseline value is associated. Then you should be able to put that height in a ratio with the height for the new font.

If your text stretches and your rows CanGrow, you can do some MeasureString tests, similar to what you see in that code I've linked to. You could figure out whether the rows are likely to stretch, given the current content, in the new font, using this information, but I think (again) it will be very, very difficult to get an exact result.

HTH, anyway,

>L<






Re: Visual Studio Report Controls Row Height in table from rdlc file

Ramona

Thank's a lot! Yes I use textmetrics, obtain the font height plus padding = a reportviewer control height, a little bigger that what I want.





Re: Visual Studio Report Controls Row Height in table from rdlc file

Ramona

Thank's a lot! Yes I use textmetrics, obtain the font height plus padding = a reportviewer control height, a little bigger that what I want. The scrollbar disappear.





Re: Visual Studio Report Controls Row Height in table from rdlc file

Lisa Nicholls

Cool beans. Ramona, you're really going the extra mile here -- getting rid of that scroll bar must be pretty important to you <g>.

Regards,

>L<