I work on an MVC application that generates reports from rdlc files. Particularly, i have a WS that generates a PDF document with one or more DataSources with a single page rdlc file.
Now my problem is : the customer wants to add a page between each page, only if a certain condition is satisfied. I can modify my rdlc file to add this document, but i can't get it to show only certain times...
I've tried playing with visibility, page breaks but it doesn't work. I've even thought about generating each page independently and merging it in one PDF file.
What would be a clean way to do it ?
If you have all your page-breaking set correctly, which you claim you did, you could wrap the extra page inside a Rectangle where you define an expression for the hidden property.
When this rectangle becomes hidden the entire page shouldn't be rendered.
If you need help with defining the expression you'll have to share a lot more information but this shouldn't really be a problem to achieve by yourself.
Related
Here we are talking about inbuilt pagging of crystal report.
which type of pagination will be in action when i click on previous or next button on report viewer??
1) load only that much data that is need to be shown?
or
2) load all the data and show only what is need to be shown?
CR loads all data for main report first. Then, while rendering, it loads all subreports data, required up to current page display. For pagination this means that next page navigation may query data for subreports, previous page uses cached data always. CR actually needs to render all pages up to current to know, where to place page breaks.
This is empirical evidence only - it could be possible that for some kind of reports or environments CR starts rendering before all data is read, but I haven't seen that yet :) Our reports usually include some nasty grouping and similar, which for example requires all data already present in report header or every page footer (pages count, totals etc). We are using "desktop" version of CR engine+viewer, maybe web server engine behaves differently.
Crystal Report builds the whole document, you can see it in the page numbering. Another technical reason, that CR can use forward only cursors that makes back paging impossible, it must load the data into the memory.
Background
I've a document that I build up throu various steps.
In one of these steps I add content to a Document from a chapter structure I've built containing the content.
This part in particular is very simple. It simply adds the content to the document.
Sometimes my structure specifies there should be a page break, and thus document.NewPage(); gets executed. This works, usually.
We are using ITextSharp version 5.3.2.0. ( A few month old or so)
The problem
When document.NewPage() get's executed and is very close to the end of the document or perhaps just entered a new page I am guessing, I get an empty page with the rest of my content being added on the following page.
Only having the Document to work with at this point I can not seem to find a way how to determine if document.NewPage() should be skipped or not to work around this bug or issue.
Thanks
This can be caused by three things:
You're using a very old version of iTextSharp. If so, please upgrade to a more recent version of iTextSharp. We don't fix obsolete versions.
You're using page events and contrary to what is advised in the documentation, you're adding content in the onStartPage() method.
You're using writer.setPageEmpty(false); which is kind of asking iText to consider an empty page as not being empty.
In all other cases, the newPage() method is ignored if you're currently on a page that doesn't have any content.
I have a web services application where I would like the users to be able to define print page templates with database field placeholder in my project.for this reason I
have to provide environment for design template for my users.this templates must save in database,
then for print I get data from database and put it in placeholders.I found that "XSLT" can be usefully for this issue, but a big problem is Html result for XSLT.If There is any solution please let me know.
thanks in advance
what you can do is: create a html file template, create field placeholder in it. When you need to print it, load data from database, replace the placeholder, create the html file, load it into webbrowser class (it does not have to have an UI). then print from there.
since it is html file, you can save it to database too.
it works great in one of our project which has the same requirement.
Using Crystal Reports and .NET I have a requeriment where I need to print 2 copies of the same report on each sheet. I´m able to do this using two subreports setting CanGrow to false, but this doesnt work cause my report may have more than one page, and CanGrow will just crop the rest of the report. Setting CanGrow to false will cause the two reports to overlap, or print one after another. I also tried making a double report, Header - details - footer, and Header - details - footer again (repeating the same information), but crystal reports doesnt allow me to have multiple details sections(with header footer sections between them).
I´m able to reproduce what I want using MsWord, in the printing settings changing the printer setting "print multiple copies" to 2, and then typing and setting Page range to "Page: 1,1,2,2,3,3,4,4... " but the printing API from Crystal Reports won´t let me adjust these settings, not even printing APIs from .NET, so I though of using Native Win32 API, but even if I´m able to do this with Win32 I don´t know how to tell Crystal Reports to use my printing functions.
I´m pretty new to crystal reports so maybe there is a simple solution for this. If someone can help.
I think you'll need to keep your subreport the way you have it, with the report details you want copied, but you can't place the two instances of the subreport in the same section and expect them to space themselves correctly. You'll need to use a second detail section in your main report for your second subreport, then they shouldn't overwrite each other. The detail sections both need cangrow = true set.
OK, all you should need is 2 reports, one formatted the way the customer wants (headers, footers, etc.) to use as the subreport, and one without any headers or footers, but 2 detail sections with cangrow=true and an instance of the subreport in each detail section. I'm not sure why you want a new page after 5 records, but try taking that out and see if you can print the same subreport twice within a main report.
I think I kind of solved it. I created two reports: Orignal, and Copy, and supressed all sections except details section and added a group using the workaround mentioned here:
http://www.c-sharpcorner.com/UploadFile/mahesh/SubReportPH10062006160749PM/SubReportPH.aspx
to be able to use headers that would repeat on every page.
I put all my header information on the group header, and the report footer information on the group footer(other sections can´t be used since they wont respect the spacing I need, that´s the major drawback of this workaround), and limit the details section to a number of records that will fill only half of the page. In the copy version I added a space in the header equal to half of the page. Then I created the report that will hold both subreports with all sections supressed and only one detail section, and added both subreports there one on top of another. This will print the second subreport at the bottom of the page leaving the space from its header for the first subreport to print on top, I still don´t know how to repeat footing section on every page by now but I think I don´t need it.
I have the requirement to create a page which contains a graph at the top, and for each item in the graph there's a fact sheet below. I already produce the fact sheets as stand-alone pages. Now, rather than recreating the fact sheet to include in the page I have to create, I'd like to use the work that already exists.
Is it realistic that I dynamically generate each fact sheet as needed, strip out the body and insert that into the new page? If so, does anyone have any pointers or suggestions? Thanks
I would suggest moving the content of the existing page into an ASCX user control - it should be a fairly quick job, and then you can incorporate it into other pages as required.
A quick way to implement this feature would be to use an iframe to load the other pages in to. This would allow you to keep using the work that already exists. Not the most elegant solution but it would work.
Hope this helps.
No, generating stuff you don't need and then removing it is inelegant at best, hackish, and will likely contribute to lowering the quality (including reliability, security etc.) of your code.
Refactor your factsheet page code to generate a header, but use a self-contained class/widget to generate the actual factsheet content. Then just instanciate and use that same class/widget on the other page as well.