SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Getting Dynamic Cell Height and Width


Getting Dynamic Cell Height and Width

Author
Message
techglider
techglider
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 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.
bulbanos
bulbanos
SSC Veteran
SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)

Group: General Forum Members
Points: 233 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
techglider
techglider
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 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?
bulbanos
bulbanos
SSC Veteran
SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)SSC Veteran (233 reputation)

Group: General Forum Members
Points: 233 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
techglider
techglider
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 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.
techglider
techglider
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search