C# Reporting anchor to bottom - c#

Here's something I've not been able to solve. We've moved over from FONET to Reporting to provide decent PDF exporting and printing. There's no (free) way to print generated PDF's we could find without using an outdated version of Adobe Reader, and we can't install a third party program everywhere.
We are making invoices this way, with a variable numbers of invoice lines (which are variable in height too), and an optional remark. This in a subreport. At the bottom of the last page, we want the totals without VAT, the total VAT and the totals including VAT. When there is no VAT in this invoice, these lines are hidden.
However, there is no way we found to anchor these totals to the bottom of the last page. We are already using the footer to show something on each page, and abusing the header to show the column headers for the invoice lines, as the row headers are not repeated on the next page.
What we've tried:
- We've tried adding a footer to the invoice lines subreport to show this, but this can't contain a Tablix and doesn't show.
- Adding whitespace between the invoice lines and totals only works with a few invoice lines. When more than 4, it places the totals on the beginning of the next page. Removing the whitespace places the totals right after the invoice lines, while we want it at the bottom of the last page.
- We could work around this in FONET, by using an absolute table, but we have not seen this possibility in Reporting.
- We would use another system if it's simply not possible. We need something which supports designing, tables which can be populated with DataSets or IEnumerables, anchoring, embedded images, direct printing and exporting to PDF. Localization (strings based on language using default resource files) support would be a huge plus.
Thanks in advance,
Nick

My answer is a year late, but maybe this will help someone
Had a similar problem while printing an envelope cover with a title at the bottom. I found questions like yours, but no answers. After banging my head for a couple of hours, i've got it.
Keep the controls with variable heights in a rectangle & make the rectangle as lengthy as you wish and keep the other controls (which you wish to print after a variable gap) below the rectangle - Check the image below
Now, if the 'CanGrow' controls inside the rectangle grows, it does so without pushing the controls outside the rectangle. But beware, if the controls grow beyond the size of the rectangle, then the rectangle will grow & push the rest down.
That's it. But Wait!!! I moved this report from VS 2008 to ReportBuilder 2 (& 3) and this did not work. After pulling my hair for another 2 hours - here's the issue
Select the Report (not the body) and set the 'ConsumeContainerWhitespace' property to True for this to work. Whitespaces are consumed both to the right & bottom within a container - I guess this is the default & only behavior in VS 2008 & VS 2005's report runtime.
-I've been developing on the .Net platform for the past 6 years, comfortable with almost everything, but this damned fine reporting component never fails to annoy me!

Related

C# : problem to arrange my layout dynamically

I'm trying to develop a tablature editor with a specific look, and I'm struggling to display my controls as I want. I think I'm doing it the wrong way so I need your help! I'm working on Visual Sutdio with C# / Winforms.
Ideally, this should look like this : [1]: https://i.stack.imgur.com/B3q5r.png
Basically, this is an A4 sheet on which I display a datagridview with custom borders. As I progressively fill the datagridview, this one should expand: I do that by adding columns dynamically.
The problem is when I reach the right border of the sheet, it should expand on a new line (like a flow layout panel: when there's no more space the control is added on a new line).
I don't manage to do that. If I add more columns to my datagridview, a horizontal scrollbar appears instead of going on a new line. I tried to mix my datagridview with a flowlayoutpanel but I can't make it work.
Have you got any idea on how to do that? Any help would be highly appreciated.
EDIT :
So in my picture, the grid represents the subdivision of the beat (musically speaking). Each beat is divided in 4 subdivisions (=4 columns).
The numbers represent the notes on the instrument, and several notes can be played at the same time (that's why there are sometimes 2 or more notes in the same column). On the contrary, we can also play 0 notes at a given time, that is why some columns are empy. The user write these notes
Consequently, 1 beat = 1 grid of 4 columns * 4 rows (4 notes maximum can be played at the same time).
The horizontal line is just an indication wether the note should be played with the right hand (above the line) or the left hand (below the line). When the user writes the notes, he decides where to write them.
Each time I add a beat, I add 4 columns. So my whole tablature is a grid of 4 rows * X columns (X being a multiple of 4), in which the user writes the notes he wants. My problem is that I would like to "cut" my grid and display it on several lines so that it fits an A4 sheet.

How to fix rectangle height in Reportviewer Visual Studio

I am working with Visual Studio 2010 ReportViewer WinForms.
I have been unable to figure out how to fix the rectangle height in a report. I've tried using a table within the rectangle, also a table in a sub report that is placed in the rectangle of the main report with no success.
Basically, I am setting up an invoice-type report that must keep its' form and should not be allowed to grow so that elements are pushed onto a second page.
Both rectangle and tables will always grow vertically based on the content. There is no way to really stop this.
There are a couple of properties that might be able to help you get the correct page breaking in place:
KeepTogether indicates whether to keep all sections of the data region together on pane page.
When set on true and the region is to large to fit the page, this will add a page-break before the start of the region to try and fit as much as possible on a single page.
So if you wish for the region to start at the initial location but break afterwards, make sure this is to false.
PageBreak has the parameter BreakLocation which can be used to determine a fixed place to add a page-break. You can set it on Start, End, StartAndEnd or Between.
You could split your report in fixed pages and use these to add standard page-breaks in the desired (fixed) locations.
These properties alone might not be enough to get your desired result. Especially when working with tables it is hard to add a page-break after a fixed amount of rows.
It is hard to give you a detailed description of a possible approach with the amount of information you gave me, but here is some general advice.
You should split your data in the correct intervals before sending the datasource to the reporter. You can for example use grouping to place them in the correct intervals and add page-breaks based on the grouping.
Another solution is to add them in separate containers, this will require you to have enough spare data regions at your disposal. If there are too many you can always hide the empty ones based on an expression set for the Hidden property.
It won't be easy to set this up correctly so that it can dynamically grow. It takes a lot of puzzling from your end but pretty much any layout should be possible to achieve.
I wish I could give you a more specific solution to your problem and am willing to help you further if you give me an example to work with. But ultimately this is something you should be able to achieve on your own.

charts for x-axis (name is too long overlapping)

I have a chart for windows phone 7.1. However the display name on the X-axis is too long and causing a overlapping to one another. Example of it:
How can I solve this ? As I need to display 7 more columns of hawker name. Removing the series at the side will only help a little. Guide on this thanks !
Let me give you some practical advice since I have been down this road before:
1) Have a limit to the max chars in header and show ... after that
2) If someone from marketing argues about that, show them that it looks ugly in every program including Excel
3) Try using new lines to fit things better
4) Reduce font size
The algorithm should try to play around with new lines and font sizes to get a best fit and if the text is too large trim the end of it.
If someone from marketing/management argues about that, show them that it looks ugly in every program including Excel

MS Reports rdlc c# win forms multiple columns

I am trying to create a Report with two columns.
Records should add in as below...
1.Bob 6.Sarch
2.Sue 7.Barrie
3.Adam 8.James
4.Dave 9.Steve
5.Robin 10.Euan
11.Fred
12.Heidi
13.Liz
For the first column (1-5 in this example), a page break should wrap the data to the second column (6-10). After the second column is full (11-13) the the data should page wrap.
The data used to generate the report will have a fixed number of columns. The height and width required for the data will not change.
I am using with C#, WinForms, .net4. I have tried several various approaches with no success. Thus far I have only managed
1.Bob 2.Sue
3.Adam...
Please help or point me in the right direction :-)
Many Thanks
TL;DR ---> This isn't possible with SSRS, afaik.
If I understand correctly, you want to list the items in a data set, that when rendered with a hard page break renderer will render with these requirements:
items are added vertically as long as there's space on the page
a new column of items is started when the first column ran out of space, vertically
a page break is inserted when the second column filled up the vertical space, thus starting a new, first column on a new page
Now, there's only these controls in SSRS:
Textbox
Table, Matrix
Chart
Gauge
List
Image
Subreport
Line, Rectangle
Out of these only the Tablix (Table/Matrix) and List are remotely capable of such a thing, but they can't satisfy your requirements. I'm afraid the answer to your question is that this can't be (easily) done.
The hard way that this may still be possible is perhaps by creating a custom report item and/or by creating a custom rendering extension. But that may be overkill for just wanting to create a nice little list.

Covering Subreport with Text Object PROBLEM

What can I do for subreport so that When i click on it, it won't appear on the seperate page?
I actually found a way but it is really ugly and not convenient for long reports.
My way is that.. I cover the subreport with a text object. And extends the length of text object depends on how many rows the subreport have.
It is work fine till some time.
For eg, My report has over 100 rows. If i only show up to 90 rows, it is ok. If i show over 90 rows, the error message pop up.alt text http://www.freeimagehosting.net/uploads/a47646b658.jpg
I think the length of the text cannot follow up.
Could anybody tell me why?
The reason is the height of a section is limited to 32K. So more than that, there will be an error.
If there is 2 reports, then one of them should be a short one.
Make it a sub report and cover with the text object.
Make sure that it won't be over 32K of length.

Categories