Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Getting Dynamic Cell Height and Width Expand / Collapse
Author
Message
Posted Wednesday, February 16, 2011 3:22 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 28, 2011 12:04 PM
Points: 12, Visits: 41
I have a table that i generating data and adding an image as a link in. But the text for each row, may make each cell's size unique. Is there any function i can call (in expression) to get the size of that cells height and width?

Reason:
I am trying to center the image in the cell. The image is static in size, so if i can just calculate the width and height of the each cell, i can pad the image accordingly..

Unless someone has an easier way to do this.
The image is being embedded into the cell.

Thanks.
Post #1065335
Posted Thursday, February 17, 2011 2:54 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, November 14, 2012 1:27 AM
Points: 45, Visits: 200
Someone has tried that already. It's a 'hack' thought but it works and I agree that it sucks since in R2 you have the same problem with data bars and sparklines.





My LinkedIn profile
Post #1065522
Posted Thursday, February 17, 2011 7:39 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 28, 2011 12:04 PM
Points: 12, Visits: 41
I tried this variation in a sense, but kind of got lost at step 5 where he declares the objects and such. Not sure where this is done, and i have not also seen any 'can grow' options.

Maybe, I will re-read it again and see where i get. Could you help me with the declarations in the beginning of step 5 and where those are placed?
Post #1065668
Posted Thursday, February 17, 2011 7:42 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Wednesday, November 14, 2012 1:27 AM
Points: 45, Visits: 200
Do you mean the .NET memory stream etc?
If you don't manage I wouldn't bother with that and just hard code the height and width of your image.
Or perhaps, you can find it in the .rdl he provided






My LinkedIn profile
Post #1065671
Posted Thursday, February 17, 2011 8:05 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 28, 2011 12:04 PM
Points: 12, Visits: 41
I haven't built to many .rdl's before. Probably only a dozen or so, but never had to get into more complicated processes. I have it hard coded for width which is fine, but the height of the cells can change. So it's not always centered in respect to that axis.
I am not to sure what the .NET memory stream is.

Looking at the following:
=CStr(Round((3-System.Drawing.Image.FromStream(new System.IO.MemoryStream(CType(Fields!Photo.Value,Byte()))).Height/96)/2,2))&"in"

It seems to be getting the dynamic width/height of the image, in my case which is static.
So i don't see a need for getting the image specs, since I will always have them. The difficulty comes in when I have the cell set to dynamic height for text. I will never know what the cell height is, which is why i was hoping there was a function that grabs the cell height, unless it is calculated at run time..

Seems there many not be any options for a centering an image in a cell with a dynamic height.
Post #1065694
Posted Thursday, February 17, 2011 2:49 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, July 28, 2011 12:04 PM
Points: 12, Visits: 41
Well i figured out a way to do this.

I basically took the dataset and added a column that would compute the length of my data that would make the height vary. I used the max total lines that could come back (by using the char length per line), and converted that into the dynamic height of the chart in inches.

May sound confusing but it works. I used this for centering my image link and bar chart in my table.
Post #1066034
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse