Spacing width between lines - reporting-services

I've got a textbox which has text that is coming from a stored procedure. I'm trying to increase the line spacing between text so that the text doesn't seem so "squished together".
i.e.
ABC
DEF
I want slightly more spacing between ABC and DEF. Using the newline operation isn't feasible, because the spacing will be too large.
I've tried using the line spacing property option but that hasn't made a difference.
Edit: DEF should be directly under ABC in the example.

What you want is unfortunately not possible in SSRS. From the relevant documentation, here's the limited list of what you can do with CSS in reports:
text-align, text-indent
font-family
font-size [...] Supported units are: in, cm, mm, pt, pc. [...]
color
padding, padding-bottom, padding-top, padding-right, padding-left
font-weight
Your question speaks of "line spacing" (i.e. line-height?), but your examples seem to be about word-spacing. Unfortunately, neither's available in SSRS.
For word-spacing I can only think of hacks and workarounds, most of which aren't pretty:
Use SQL or expressions to double spaces, e.g. Replace(Fields!Xyz.Value, " ", " ")
Choose a different font that allows for more space between words.
Beyond that workarounds get even less pretty.
For word-spacing I can't really think of any workarounds, except for the one you used (linebreaks) or using a different font.
Bottom line is probably that you can't really do anything about his, AFAIK.

I was able to control this by double spacing my text and then changing the font size of the second line break
For example:
text <--CRLF, 8pt
<-- CRLF, 4pt
text
It's not very scalable, but it does the job.

Try adding padding in the textbox and changing the vertical alignment. It will increase the space between the cells. Worked for me.

I know this is an old topic, but you can do that by changing SpaceAfter and SpaceBefore properties.

Try this:
TextBox Properties -> Font -> Line Spacing -> Custom
UPDATE:
This is Microsoft bug..
The line spacing depends on font size... option below doesn't work..

Yes you can make a line any height you want. When you select the line on the far left side of the row drag your mouse to increase the row height. Set the vertical alignment in the text box to Top. This will stop the data from moving to the center of the box or you can use padding options for the bottom.

There isn't a way to natively do this, but a very customisable way is to simply add lines in between your lines manually and change the font-size so that the line size decreases respectively. A bit time-consuming but better than nothing.

I finally found that if I add blank expressions within my text I can trick SSRS to double space.
right click-> Create Placeholder
Do this mid sentence on the second or subsequent line
Set the Value in Placeholder Properties to ="" (*an empty string*)
you will have text in your SSRS document that looks like this:
I want to <Expr>double space.
Now highlight the <Expr> and set the text size to double the font you're using
And the report will render with the effect of double spacing.

Related

How to vertically align picture in line using python-docx

I am adding a picture (some latex converted into a PNG using matplotlib) to my text using the following code:
par = doc.add_paragraph()
par.add_run().text = 'foo bar baz'
par.add_run().add_picture('pic.png')
par.add_run().text = 'blah blah blah'
This works OK, except that the picture pic.png is not vertically aligned in the rest of the text in the document:
I can get the alignment manually in MS Word by adding a character style with the advanced vertical alignment property set to "lowered by 10pt":
The problem is that I have no idea how to do this programatically using python-docx. Conceptually the steps would be to compute the size of the image, create a character style that was lowered by half that size minus half the size of the font and apply the style to the run containing the picture. How do you create a raised or lowered font style in python-docx?
For reference, here is pic.png:
Your image has a fairly large (transparent) border around it. I added a single pixel border inside its extents here to make it visible:
I expect Word is aligning the bottom of the image with the baseline (as expected). One approach would be to see if there was a way you could specify zero bottom border.
You could also try subscript on that image run. I'm not sure what it would do but it's worth a try. So something like this:
run = par.add_run()
run.add_picture('x.png')
run.font.subscript = True
If you find the run that you manually set to "lowered by 10pt", you can view the XML for it like this (aircode):
run = vertically_adjusted_run() # however you get ahold of it
print(run._element.xml)
I expect you'll see something like this:
<w:r>
<w:rPr>
<w:position w:val="20"/>
...
... where the w:position element sets the adjustment from the baseline. The value is specified in half-points.
Anyway, neither this adjustment nor even that low-level element are supported by python-docx yet, so you'd need to get in there with lxml calls to do the needful if you wanted it badly enough.

How to force browser to break text where possible?

I need to determine minimum width adequate for displaying a possibly wrapped dynamic HTML string. Without word-wrapping this is simple: create a span, set its innerHTML and read offsetWidth. However, I'm not sure how to force linebreaks... Easiest incomplete approach I see is to replace all spaces by <br/>, but lines can be wrapped not only on spaces but also e.g. on hyphens.
So, basically, I want a browser to lay out sth. like
Max.
word-
wrapped
string
<----->
somewhere off-screen to measure width of the longest contained word. Is there a generic way to do that?
EDIT
I.e., for no line wraps:
function computeWidth (str) { // code to make it off-screen and caching omitted
var span = document.createElement ('span');
document.body.appendChild (span);
span.innerHTML = str;
return span.offsetWidth;
}
How would I write a similar function which forces line breaks on str, presumably playing with span.style?
You can use CSS work-break / word-wrap and programmatically inserted soft-hyphens (­, but I'd advise you to read up on cross browser problems regarding soft hyphens, as there are quite a few - I normally us the unicode for a soft hypen (U+00AD), but your mileage may vary), and then determine the width with javascript using the range object and measuring cursor offset from the left.
I'm suggesting the use of soft-hyphens, because even the same browser will normally break words differently depending on the OS / which dictionary (on OSX) is used. If that's not an issue for you, you can do it without soft hyphens.
Afaik there is no generic way to get what you want in html/js (it's different if you were using something like flash).
Range object:
https://developer.mozilla.org/en-US/docs/Web/API/range
A different approach would be using the canvas object, but you would probably not get exact results there, as there is just too much factors influencing text rendering in browsers nowadays (font, size, kerning, tracking, ...)
Again another approach would be using <pre> tags / whitespace: pre-wrap, setting the font to what you normally use, and then either emulate breaking words by inserting linebreaks or copying them from still another span/div/whatever set up with word wrap - I haven't tested this yet, but if it works, it might be easer than iterating with the range object.
Edit: Just so it's not only in the comments, still another solution:
Start your container with width 1px, then increase the width, checking the height every time ; when the height decreases, go back one step, and you got your width. Simplest implementation would use 1px increase/1px decrease, but you could of course optimize it to using something like a binary search algorithm, e.g. starting with 1px, then 2px, then 4px increases, then the same backwards, and forwards again and so on till you have a result at a 1px step. But that's only if the 1px inc/dec sollution is too slow ;)
Use the CSS word-break rule:
The word-break CSS property is used to specify how (or if) to break lines within words.
Normal
Use the default line break rule.
break-all
Word breaks may be inserted between any character for non-CJK (Chinese/Japanese/Korean) text.
keep-all
Don't allow word breaks for CJK text. Non-CJK text behavior is same as normal.
<p style="word-break:break-all;">
Max.word-wrapped string<----->
</p>
(source)
Try to play with the word-break Property.
More here: http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_word-break
You should try:
word-break: break-all;
Add it to the CSS like in this fiddle, or read here.

how to set the same tabsize width with 4 space in sublime text?

how to set the same tabsize width with 4 space in sublime text?
I like verdana font ,then I set font to it in sublime text, but it appears that the 1 tab is much wider then 4 space. why? how to fix?
Probably, this is a problem related to how Sublime handles tabsize.
It seems to use the size of an em-dash (—), instead of the size of a space. In monospaced fonts, of course, those sizes are the same, but in proportional fonts, such as Verdana, they are quite different:
" " (4 spaces)
"————" (4 em-dashes)
So, I think that the only way to solve your problem is to convert tabs to spaces with View/Indentation/Convert Indentation to Spaces. And be sure to have "translate_tabs_to_spaces": true in your preferences and Indent Using Spaces set in Indentation menu:
The particular file you've included as a screenshot forces itself to use tabs instead of spaces, so that could be why it seems much too large of a space. Even if you set "translate_tabs_to_spaces": true, in your User Settings, this isn't applied to the Settings files themselves.
You can make sure what you're seeing is actually spaces/tabs by turning on draw_white_space in the preferences. You can do this by editing your User Settings (Preferences -> Settings -> User) and adding the line "draw_white_space": "selection", (remember not to include the comma if this is the last line of your settings).
This value can be set to "none" to turn off drawing white space, "selection" to draw only the white space within the selection, and "all" to draw all white space.
If you do that, then restart Sublime Text 2, it might give you a good idea of what's going on.

How to measure the size of the text in specific font of specific font size

I would like to do a trimming of the text that I need to display in box on a web page.
The known parameters are Font Family, Font Size, the number of characters to display and the actual text and of course the width of bounding box.
I need to calculate where to trim the source text and where to put "..."
I have an idea but it is not too fast.
If there exist some other way to do the trimming maybe in CSS I would like to know it and I can accept it as a solution too.
You cannot calculate this ahead of time. You need to position the actual text in the browser and measure the output. You can do this off-screen using a negative text-indent if needed.
There are plug-ins for jQuery that can set an ellipsis based on a fixed-sized container with overflow.
See: http://archive.plugins.jquery.com/plugin-tags/ellipsis
So long as you don't need to support older browsers, you could use this simple css:
text-overflow:ellipsis;
http://www.w3schools.com/cssref/css3_pr_text-overflow.aspenter link description here

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