Changed paper size from letter to legal and size increased - wpf

VS 2010, WPF application, and a RDLC file. My grid doesn't fit on a letter size page. So I changed the paper size to legal(14 x 11). But when I print the report it increases the grid so that it prints identically to the letter size print out. Ex.: I have 15 columns and in letter size only 11 columns fit on one page. Change to legal size and still only 11 columns fit on the page. The size of the grid increases with the paper size. It is really frustrating. Does anyone have a solution?
Thanks in advance.

If I understand the problem correctly, you don't have your width/height defined so it will fill the space it has. Define the width and height explicitly. Hope this helped!

SO...I was making an update to this report and as it turns out I was doing things right. There was code in a spot outside of the rdlc file that was overwriting what I was trying to do.

Related

WPF dynamically scale TextBlock Text without filling a container

I have a set of pages that look like this:
I have the content in grids with * Heights and Widths so the grid correctly scales when the entire window resizes. I would like the text to resize with the grid. Basically I would like the user to resize from this:
To this:
(preserving white space)
One way to do this would be to wrap the TextBlock in a ViewBox with margins on the right and bottom (for Grid.Row="3") to account for white space. But because I have several pages with different lengths and line counts I would have to set the margin specifically for each page otherwise the text sizes would differ on each page. Is there a better way to do this??
I don't think there is a better way to do this. There are different ways. But, I think it isn't just a matter of opinion that they would not be better.
Ways I can think of.
Render your text offscreen, rendertargetbitmap that so you've got a picture. Change your textblocks on screen to images and stretch them.
Or
Work out the size your text wants to be. Then do some calculation comes up with a different fontsize which is "better". This is a lot easier to write a description of than do.
In my opinion.
A viewbox is easier to implement. Way less error prone than calculations. Will give at least as good results as rendering to a picture.
I just want to add one more solution to the ones suggested by Andy, which is more of a scientific approach and takes a bit of practice to master.
Suppose you have to find a function F, which maps one or more variables to a desired single value. In your case that would be a function F, which takes aspect ratio of the window as input and outputs an appropriate font size.
How can you find such a function?
Well... you don't need to do any math yourself!
First, you need some data to begin with:
1. Resize the window randomly
2. Calculate aspect ration (X)
3. Pick an appropriate font size that looks good enough (Y)
4. Repeat the measurement 7 to 10 times (sorry data scientists)
5. Enter the data in Excel - one column for X and another one for Y
6. Insert a scatter chart
7. Choose the best trendline for your data, but avoid the polynomial one
8. Display the trendline equation and use the expression in your code
Now I should mention the pros and cons of this regression technique.
Pros:
1. It can solve a wide range of tricky problems:
"I use this 3rd party control, but when the text is too long it overlaps the title bar. How to trim it so it doesn't go beyond the top border?. Deadline is coming!"
2. Even if it doesn't solve the problem perfectly, the results are often acceptable
3. It takes minutes to try out unlike spending a day refreshing your math skills
Cons:
1. The biggest problem is that to keep it simple, you often lower the number of
variables by assuming some of them to be constant. In this post I've assumed that
the font family won't change for example, neither the font weight.
2. If any of the assumptions does not hold the final result could be even worse
This technique is fragile, but powerful. Use it as your last weapon and never leave magic expression like
fontSize = (int)(0.76 + 1.2 * aspectRation) without documenting how it came to be.

Assign indices to tiled surface

Sorry for my unspecific title (as well as my tags), I just didn't know how to describe that problem in one sentence.
I think its trivial, however my mind is blocked somehow right now.
Some surface is arbitrarliy tiled into smaller subsurfaces (4x4 in this case).
Now I want every subsurface to be assigned an individual index using the width and height of a subsurface (both=9 in this case) and the coordinates Y,Z, so that
Index=...Y*Z+Z...?

Visual Basic : Window size seems wrong

I have an annoying problem: we're supposed to write a small game for university in visual basic, now my gamefield consists of 7x6 circles, so it has six rows.
Between every circle there is certain spacing.
Now i set the windows size to rows*(circleSize + circleSpacing) - circleSpacing.
With a size of 100 and a spacing of 50 this gives me a total size of 850, and when i ask for Me.size.height it says: 850, but the window cuts of about 25-30 pixels on the bottom, why is that?
I made a button with a size of 840x840 and location 0x0, and it is not fully displayed although the height of the window is 850...?
I'm very new to VB, so might be doing something wrong, but i can't figure out what.
Any help is appreciated
The frame around the window is included in the Size property. Set the ClientSize property instead

How to Print all the columns in silverlight datagrid

Im having 17 columns of datagrid in Silverlight. How can we print all columns in datagrid to print. Since there are more noumber of column, Im enabling Horizantal Scroolbar ,so tht user can scrollto lastcolumn easily.
During printing of silverligt datagrid, i could see contents which are shown in Silverlight Page , anything beyond scroll bar ,those images are cropped and not printed . Any solution for print all columns in datagrid even though beyond the screen width.
One more question, if i have datagrid with horizontal scrollbar enabled, datagrid.actualwidth always give 768 px but not from first column to last column width size
_mahens
If you can wait six months for Silverlight 5, then you can completely control the print layout and format it exactly the way you want. Until then I'm not sure if there is anything you can do.
You basically have 2 options here.
Shrink your datagrid using Scaling to make the whole grid fit on your page
Slice the grid into 2 grids (first half of the columns in the first grid, and the other half on the other), then print this as 2 separate pages. Of course you would have to take into account the height of the grid and print additional pages there as well if required.
Difficult? Yes, but achievable :)

Page width in SSRS

I want ot draw a line the full width of the page in SSRS.
If I could get the page width in (say) px, I could assign it as an expression to the line width. Is this possible? How? Or is there an alternative?
you can't do this, because a line get the start and end point positions. may be you can set this values to a big number and this solution solve your problem.

Resources