Print only the first page of each group - c#

My report adds a page break and resets a custom page number whenever a group changes. How can I print only the first page of each group?

Crystal itself doesn't have a great way for you to programmatically print specific pages. But there are a few ways to make this kind of work:
Easy: Make a formula that generates a list of which pages are ones you want to print. (It might output something like 1,2,5,7,9, which you could copy and paste into the Page Range when you go to print.)
Medium: Make a modified version of this report that excludes any data you don't want to print. Figure out a maximum number of records that fit on a page (for example, 18) and only take the first 18 per group. (This might be easier to set up with a custom SQL statement in Crystal.)
Difficult: Same as option 2, but you write suppression formulas for everything on your report. If Page Number > 1, the entire page goes blank. After printing you just remove the blank pages from the file. Tedious, but no ink wasted...

Related

SSRS conditional page-break

I have a C#.NET WPF application that renders a SSRS report. The report has a parent grouping which I would like to apply a SSRS conditional page-break on based on its child data. The page-break function works well in that each parent grouping is place on a new page; However that could be page consuming when there is not a lot of child data for each parent.
My problem is to write a conditional page-break that will check if a parent grouping has enough child data to fit on the a page, the same applies to the next parent grouping, and so on, but if the parent grouping contains to much data to fit on a page only then apply the page-break.
As you wish to display it in a WPF application only, you can define a maximum page size for the report viewer with the InteractiveSize property. The height you define there will determine what you find is "too much data to fit on a page" and break accordingly.
For exporting to a printable format, the PageSize propery will react the same way. But this allows you to have a different size when using the report viewer, because you might want more to be shown on a single page.
With those settings the report viewer will place as much possible data on the defined space and break to a next page when the boundary is exceeded.
If you do not wish to split groups then you must wrap them inside a Rectangle because there you can set the property KeepTogetherto true, which will add a page-break between groups if there is no space for both groups on the same page.
When working with tables, you can use the following method to wrap the groupings in rectangles correctly:
Place "List" control on the report.
Set its "DataSetName" property to your dataset name.
At the design view, right click on the list and then select "Row group".
At "Group Properties" window, click "Add" button under "Group Expressions:" title and then choose field name that you want to group
within a page.
After that you can place "Table" control for your detail data inside the row group.
Once you render the report, report will keep data inside the group together between page break.
Source: https://stackoverflow.com/a/15656441/4579864
I hope this solves your problem. If you have any more questions, just leave a comment.

Page of PDF written in footer

Does anyone an idea how acrobat reader knows the page I am currently viewing?
For example - I have a PDF file which contains page numbers in footer in format - 1/A or 1/1 - divided into chapters, and acrobat knows that this is number of page - it doesnt write only total number of pages from beggining to this current page.
I am writing C# apps, WinForms, where I need to get number of page - in the same way as acrobat does.
I am converting each page into text with pdfLibView lib, but then, I need look at last page and use complex algorithms to find out which string in footer is page number - it can contain any other informations.
So any idea, how to get page number in format as it is written on this page?
It seems like your document uses page labels feature defined in PDF specification.
8.3.1 Page Labels says:
In addition, a document may optionally define page labels (PDF 1.3) to
identify each page visually on the screen or in print. Page labels and
page indices need not coincide: the indices are fixed, running
consecutively through the document starting from 0 for the first page,
but the labels can be specified in any way that is appropriate for the
particular document. For example, if the document begins with 12 pages
of front matter numbered in roman numerals and the remainder of the
document is numbered in arabic, the first page would have a page index
of 0 and a page label of i, the twelfth page would have index 11 and
label xii, and the thirteenth page would have index 12 and label 1.
You might try Docotic.Pdf library if you want to access page labels information in an existing document (disclaimer: I work for the vendor of the library).
Here is a sample for how to add Page Labels to PDF document. This sample doesn't show how to access existing labels but might give some clues for a start.

Paragraph breakage, one page to the other page, in detail section of Crystal Reports

I have made a report in Crystal Reports, it has a detail section, i have dragged a variable carrying text and if the paragraph of the text longer, i want its half of the part should be gone to the next page, as we see in text books and as it is a standward way on A4 paper.
When i write a variable carrying data in text for detail, this problem occurs. I had used some algorithm or like that to divide the data into two parts and made two variables, but as data can be html also so that algorithm does not work in very good manner. I just want to use crystal reports functionality. Thanks in advance.I am attaching an image for further understanding.
The history field should have a property called 'keep together'. I'm guessing its set to true and should be changed to false to allow the field to be split across a page break.

Is it possible to specify number of pages in rdcl report c#?

I have a rdcl ready to be populated.
It mainly contains a table that occupies the whole width and a few Textboxes under it that show summary info.
Sometimes the table will have a lot of lines and other times only a couple of them. This makes the texboxes to end up in the same page or a 2nd (or a 3rd) depending on the situation.
I wanna know if it is possible to so specify a jump to the next page for the textboxes.
So for example even if the table has only 1 line, and there is enough space under it to fit the texboxes info in 1 page, i want them to start at the 2nd page. And if the table is too long and occupies 1 and a half pages, the textboxes should appear in the 3rd page, and so on.
I thought of creating a 2nd report with only the textboxes but then the page numbers do not match and also the reports are showed in different windows.
Any pointers are most welcome.
As far as I know, if the report objects exits on the same rdcl you can not send them to a certain page.
You can, however, alter the "PageBreak" option on the Table to "End". This will push everything after the table onto the next page.
This will help you get the desired results you are after.
EDIT:
You could also get rid of the numerous pages all together by changing the Report property "InteractiveSize" to a height of lets say 50in. This causes the report viewer to page break much less often (every 50 inches) and would most likely place all of your content on Page 1 in the report viewer.

Word Automation: Detect if page break is necessary?

I am working on a project in C# that will produce a Word document using the Word Automation API.
I would like to insert page breaks at specific points in the generated document and I am currently doing this successfully with the following code:
// Generate page break
object pageBreak = WdBreakType.wdPageBreak;
wordApp.Selection.InsertBreak(ref pageBreak);
However, if the document has naturally wrapped onto the next page anyway after running out of room on the previous page then I don't really want to be generating a page break or else I will end up with a blank page.
What I would really like is the ability to find out exactly where the cursor is and if it is on the first line and column of the current page then I can safely assume that it is not necessary to insert a page break.
Is there a way to access the position of the cursor? Or another solution that would do the same thing? It seems like a simple requirement so I apologize in advance if I have missed the obvious.
Assuming that you are programmatically building the document in a way that would cause wordApp.Selection to properly reflect your actual (and relevant) position in the document, you can determine its line and column on its starting page using its Information property and the following two WdInformation enums (shown here as VBA; not sure what the .NET PIA syntax is offhand):
line = wordApp.Selection.Information(wdFirstCharacterLineNumber)
col = wordApp.Selection.Information(wdFirstCharacterColumnNumber)
These values correspond to the Ln and Col values seen in Word's status bar. If they are both equal to 1, then you are in the first position of the page on which the Selection begins.
Good luck!
You could try setting property on the paragraph that causes it to have a page break before it. I don't if Word Automation API allows it to be set, but it seems exactly what you need.

Categories