Getting Dynamic Cell Height and Width

  • 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.

  • 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.

  • 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?

  • 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

  • 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.

  • 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.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply