Float or wrap text around a chart? - reporting-services

I've been searching and searching for an answer to my question, but I can't seem to find anything. Does anyone know of a way to wrap/float text around a chart or image in SSRS? I was hoping for some kind of option similar to the blue one below in Word, but no luck there:
I found the following post, which has a good example image of what I'm looking for, but doesn't have any helpful answers (I'm not using Crystal Reports, I'm using BIDS SSRS through Visual Studio 2015).
Crystal report (or SSRS) flowing text around image
I've tried the following:
Overlaying a text box on top of the image (rendering shoves the image below the text)
Trying to find or create a mad scientist algorithm that can split the text after a certain number of characters, but not in the middle of a word, chop off the rest, and continue the rest of the text in a separate textbox under the image (not a mad scientist, so no luck)
Thanks for any tips!

There's no built in way to do this in SSRS.
Someone wrote a function that determines how many pixels are in a given text string.
Truncate textbox content with ellipsis in SSRS
Public Function TextWidth(str As String) AS Double
'Returns the width, in pixels, of a string, assuming Tahoma size 8.
Dim size As System.Drawing.SizeF
Dim font As New system.Drawing.Font("Tahoma", 8)
size = System.Windows.Forms.TextRenderer.MeasureText(str, font)
TextWidth = size.Width
End Function
You may be able to use this to figure out where to make a break in the first text box and spill the rest to the second. You'd just need to do testing to figure out how many pixels of text your first text box holds.
Once you figure out how many pixels would fit (I would just fill the first text box with text then use the function to see how many pixels that text is), change the other TextCap function to return either the first or second part at the pixel split. You could add an Argument in the function to indicate whether to return the first or second part of the text. Then use the function in the first text box to return the first part and the second part in the second text box.
It's a bit of work but seems feasible. It depends on how bad you want it and how much time you have.

Related

ssrs keep certain "chunks" of text "atomic" within a report header

I have some text I want to keep "atomic" within a report header. The text in question is the "Period Ending Date: 1/15/1998". It is OK if that block of text wraps down below, but I would like to keep the whole block of text together on one line. This has to be dynamic however, as the text will grow and shrink dynamically--sometimes the server and database and company name will be short and everything fits on one row, sometimes long even the database name will need to wrap.
And this is how I have it defined in the expression
Is keeping it "atomic" possible?
As the comments say you basically have two options, either make the text box wide enough to fit any possible combination of company, server, database and end date that could occur - you can use max(len([your fields])) in SQL to determine the maximum possible characters and then figure out the width from your font information - or you can put the separate chunks of information into separate text boxes and arrange them however is most aesthetically pleasing to you. Personally I'd have a company name box on one line, the Server and database beneath it and the end date beneath that. Up to your preference though obviously.
#Jeff.Clark, I guess you need to rethink the design. I agree with #Viking's comment. As far as i know, what you are trying to achieve is not possible in SSRS (keeping the Can Grow = False) and want to wrap it on the field level not the word level. I tried using it in the placeholder but it is splitting the field.
However, if your requirements are very critical and no matter what you have to do it in this way then i think you can achieve it by determining maximum characters the cell can accommodate in one line and then subtracting the SUM of LENGTH of the the fields+ the text(ex: "Totals per payroll period") and find out a position in your string to insert VBCRLF so the rest of the data will go to next line. Without the original expression i will not be able to provide the accurate updated expression but it will be nested IIFs to get the position of VBCRLF. I personally do not prefer this method because it will take lot of processing on the report design level and can affect the overall performance of the report as well as not very pretty when it comes to the maintenance of the report.

SSRS RDLC character appears partially hidden in report

I'm new to SSRS reports, and I didn't write this report, I'm just trying to fix it; and I've had no luck searching for anyone else suffering from this (too many false-positive matches).
Part of the data for a field is being rendered in a way that leaves half of the first character invisible. Perhaps the best thing to do is to show a screenshot of the problem (see the data in the final column):
StackOverflow says I don't have enough reputation to embed the image; but it's here:
http://i.stack.imgur.com/1YtcB.png
The "8" character is being chopped in half. I don't understand why the data isn't forced inside the 2pt padding, or why it doesn't split the date value between the date and time.
By the way, I suspect there is little value asking why the penultimate column looks OK: the columns are different widths, and the penultimate column is an expression returning a DateTime whereas the final column has to handle the possibility of the DateTime being null.
The RDLC file is here (requires you to download the file; suggestions of a better alternative are welcome): http://www.filedropper.com/markerprogresssummarybycomponent
It looks like it's attempting to fit as much of the date/time on the same line without wrapping as possible, which doesn't necessarily fit in that cell.
2 Suggestions:
Increase the width/padding of the cells that are cutting off text so the
entire date/time fits
If it's not a problem to have the time shown on the next line, you could force it to wrap at the time part, thus eliminating the issue:
=Replace("8/6/2015 12:35:02 PM", " ", chr(10), 1, 1)

SSRS 2008 and Dynamic Positioning of Text Boxes

I'm trying to produce a pay check. I will allow the user to setup the position of the items according to their check style.
From my research, it seems that the position of text boxes in SSRS is static and not dynamic. There is no "expression" option for Top/Left. I thought a way to get around this might be to make the text boxes large and overlapping and then set the padding top/left based on expressions to the positions that user has selected. However, it seems that similar to HTML, the text boxes either float around the higher level text boxes or simply drop out of view.
This would be simple if there were a way to tell SSRS not to be concerned with the order of the text boxes and simply display them overlapping, however I don't feel that there is.
Given that, what other options to I have for dynamically positioning text boxes in an SSRS 2008 report? I'm moving right along with this project but I've hit this stumbling block.
SSRS gives you a lot of options for dynamic formatting but Size and Location are fixed. You cannot change this. Overlapping of textboxes does not work in the soft-break renderers like HTML and Excel but does work in hard-break renderers like PDF or TIFF. Have you tried your padding technique and output the report as PDF?
I'm not sure what are going to do in your report, But in similar cases I usually use Space character to position a text. For instance,
IIf(Len(Fields(YourColumn.valu)) > 10, Fields(YourColumn.valu), "    ")
Note that you have to ensure it can implemented in your case or not. I'm not sure that it is helpful but as long as the location and width properties are fix this is the only option
Note 2 : I'm using Unbreakable Space character instead of simple Space so that SSRS render it without any problem

Access report "Can Grow" property needs to effect neighboring controls

I have a report with a bunch of controls in the Detail section.
I am working off a word document that was given to me as a sample and I recreated it in access almost perfectly. What I need now is a way to handle overflowing the text boxes. I have "Can Grow" enabled, but here is the real issue:
I have a fake table going on. Multiple text boxes arranged in a way that just doesn't work in a subform. Certain cells have red, green or yellow backgrounds while others are just plain white. When one of the text fields overflows, and "grows", the other text boxes in the same row stay the same size as before and it looks very very odd (703 twips vs 300). I would really just love for it to work as if it were a table in word/excel and the entire row would grow at once (all =703 twips), but seeing as how it isn't literally a "row" I just want a way to associate the height of these text boxes with each other.
Is anything like this possible? If I need to clarify anything just let me know, I hope I've given ample information.
In the design view of your report select all the textbox controls in the detail section and all the labels in the page header section. Right click on one of the textbox controls and select Layout -> Tabular. The controls and labels should now align with each other.
You've not set which version of Access you're using but this works in Access 2007.
Ok here we go. So I had a fake table, I needed it to have table borders around each text box and when one text box got taller than the others in the row, the borders would look totally wrong. So, what we have to do is literally draw on the report at runtime, which can be done in any view including print preview. This code must be placed in the Print event
'step one. find out which box in the row has the greatest height value.
'You can come across this information however you want.
'It will likely depend on what data goes in the boxes.
'For the sake of the answer length we will skip that actual code
'step two. Take measurements and store them in variables.
'You will need a start point, and an end point in standard (x1,y1),(x2,y2) form.
Dim t As Integer 'top
Dim l As Integer 'left
Dim b As Integer 'bottom
'step three. Use these measurements and draw your lines.
'Try to use looping if your naming and report layout work will allow it.
Me.Line (l, t)-(l, b), RGB(0, 0, 0)
' (x1,y1)(x2,y2),pick a color
'We just drew a line straight down the length of the control
'If you plan ahead, and place a line on the report permanently on top of the first row
'and below every row, you will only need to draw vertical lines.
'The lines below each row will be pushed down by the tallest control
I hope this helps. I had no idea this stuff existed before at all. Here is the MSDN info about it: http://msdn.microsoft.com/en-us/library/aa221362%28v=office.11%29.aspx
OK...
1 - Go into Design view of your report
2 - Select ALL the textbox controls in the detail section that you want to be table like and ALL grow if any one grows.
3 - Right click on one of the selected textbox controls and select Layout -> Tabular.... but... now... after you have your textbox row controls as a tabular layout... You must do one thing more...
4 - Inside your reports FORMAT TAB properties... Set ALL PADDING properties to 0.00... 0.00 for Top Padding, 0.00 Right Padding, 0.00 Left Padding and 0.00 Bottom Padding. (default is usually around 0.0208)
5 - Please note that changing your textboxes to a Tabular Layout kinda throws your textboxes to the right (at least for me) so you may need to re-adjust them so they are aligned with your Page Header textboxes again (if you have any that you might be using to header name your table like columns).
6 - Make sure ALL SPACE is removed in the detail area by having the bottom bar (page or report footer) snugly up against the bottom of your Tabular Textbox Layout and also ditto with the upper detail bar (page or report header).
7 - Now when you look your report in print preview with max 200% or more zoom you WILL still see very very minor spaces between your cells in your layout but when you actually print they will be almost unnoticeable unless you take out a magnifying lens.
I found a solution for my situation but I would like to have a better one...
In my case, a TextBox at the left side is describing the content of 1 to 3 pictures on the right side. The TextBox, if enlarging more than the height of the first picture, would shift pictures 2 and 3 down, in spite of a properly designed Top-Attribute in the picture controls.
My solution: I put the height attribute of the text box to 15cm (e.g 2 Inch) and enable it as shrinkable.
However, strange, but this helps for positioning the Pictures at its desired Top-Locations... :-) as well as minimizing the horizontal space used.

Dealing with very tall textboxes and pagination in SSRS 2005

I have a report in SQL Server Reporting Services 2005. It makes use of a page header and footer and has no subreports. The body portion contains a few smaller elements and then a simple single column table. The table has a single header row and a single detail row. The header is just a label, basically. The detail row is a single textbox with a simple Fields!FieldName.Value as its output.
The problem is that FieldName, in this case, is a highly variable length string. It can be a sentence up to 8000 characters (usually no more than 2 pages worth). The text can contain line/paragraph breaks (returns) but no other special formatting. Everything is fine so long as the content fits on one page. Once the text exceeds a single page (8.5x11), the text is very nastily cut off abruptly. Since this is a pagination problem, it is only visible when exporting to PDF or when viewing the report in Print Layout.
It seems as though there is a maximum size the row can grow to on the first page and then it chops it off and starts it up on the second. But this cutoff is not carefully managed in relation to the text. It can occur right in the middle of a line, causing it to show the top halves of the letters on the first page and the bottom halves at the top of the second page.
Obviously, this is unacceptable, as it looks very unprofessional and can impair the readability of the line that was so messily split. I also can never be sure it'll split badly, as sometimes it more or less ends the page evenly, though usually I can still see the hanging tails of certain letters on the next page (g and p for instance).
The secondary problem is that I'd really like the table row header to repeat on each page. Setting the obvious property, "RepeatOnNewPage" has no effect. I suspect this is because it's still trying to show the single really vertically tall row. It seems like it's okay repeating headers and splitting pages nicely between detail rows. But because this is basically just a big block of text, and thus just one really tall row, it doesn't split it nicely.
What can I do or use to solve this problem? I can live without the repeating header so long as it just doesn't cut off text in the middle of a line.
Unfortunately, page break fine tuning is one of the biggest weak points of SSRS.
I can only suggest that you break up the long text into multiple rows before SSRS ever gets it. You'd want to parse the text to look for word breaks. The result will be odd looking breaks in the output since you won't know where the break will come on a line in the printed report. However, it'd be much more readable than cutting text in half.
If the text is comprised of reasonably sized paragraphs, you could parse it out that way instead.
You might even go so far as to measure the text using SQLCLR and the System.Drawing.Graphics.MeasureString method to fine tune the output but I wouldn't recommend that route for the feint of heart.
In SSRS 2008 R2 and Visual Studio 2008:
Click (not-right click) a textbox and go to the properties window (lower right side of VS) -> KeepTogether = false.
The text will cleanly cut between a line and continue on the next page.
Just thought to add here as searching for this doesn't return many results.
I have done what JC has suggested in the past where I've broken down the text into paragraphs and each paragraph would in effect be its own row. Works pretty well given the limitations of SSRS.
One thing to be careful about is that you would need to make sure that your paragraphs sort properly. In most cases it would display them in the correct order, but adding in a column with sortID to give some sorting hints to the table would probably be a good idea.
In the end, the cut-off-text problem was due to non-standard padding on the textbox in question.
For whatever reason, having padding any greater than the defaults (2pt all around) seemed to cause its pagination to go sour. I imagine it is due to the algorithm not taking padding into consideration when deciding where to break the paragraph. With default padding, the line always ends cleanly and nicely on each page.
As a workaround (since I liked the extra white space the padding gave to the layout), I used a rectangle to achieve the border and made the textbox inside it smaller than the rectangle by about an eighth of an inch. This gave the box some inner padding while still apparently allowing the pagination to correctly determine when to break up lines.
Still, a lot of unnecessary headache.