Table of contents with page number - how to implement - jasper-reports

Is it possible to implement Table of contents with page number on first page of the PDF report?
I've read the below links and refered in google:
1) http://community.jaspersoft.com/questions/541300/table-contents-ireport
2) http://community.jaspersoft.com/questions/529040/generation-page-numbers-table-content
On first link, They are using scriptlets for this. I want Table of contents with page number on the first page of pdf report. But I do not understand where to start. Any ideas?

I would recommend you checking this sample from the original documentation.
There is no way (or at least I don't know/haven't found how) to generate the Table of Contents at the beginning (since there is no way to know the pages numbers). So you will have to generate it at the end (in the summary band) and move it afterwards to where you want to place it. To move it use JasperPrint class, methods getPages, addPage, removePage.
I guess you will have subreports, if so, you need to pass the JRBeanCollectionDataSource you will be filling during runtime to each subreport (and return the value back to the master report).
Hope that helps.

Related

How to rearrange report section at print time in ActiveReports?

I need to print the report footer before the group header/footer in ActiveReports 6. My code in report footer requires calculation from the group header/footer, so instead of moving all the controls to report header and do massive changes to code, I wonder if there's a quick way to just rearrange the page at print time.
I currently have:
rhMain (reportheader) for report cover page
gfVehicle (groupfooter) for detail on each vehicle, summary data is also calculated and stored here for each vehicle to be used in report summary
rfMain (reportfooter) for report summary
What I need to be arranged:
rhMain cover page
rfMain summary page
gfVehicle detail on each vehicle
What I have tried is move all the summary stuff to rhMain and during rfMain_format, I change the value of the controls in rhMain. This failed probably because rhMain is already rendered at this point.
Any other ideas?
There is no way to rearrange the sections during printing. The sections are designed to be rendered in a specific order and it cannot be changed. If you can provide some detailed information about your use case we may try suggesting some workaround. You can post your questions to ActiveReports support forums.
Can you please explain your scenario so we can try to help based on it. In general a report footer is nothing but a "group-footer" for the whole report (that is not bound, so would it help to replace the report-header/footer with an outside group header/footer.
Please include an image of what you're trying to do so we help further.
Issam Elbaytam
Grapecity.

In SSRS How not to split same column on 2 pages

I have 20 columns on report. We have provided user to exclude columns which don't want in report. So we made hidden.
Problem is when I get report then any last column on page gets appeared some part on 1 page & some part on another page.
Can you please help.
hi i hope i understand your question correctly. you want to avoid page breake for a tablix? mark the tablix go to properies and check the PageBreak Options for me tDisabled = True works to render all informations in one page.
if it is still not working check your pagelayout in report --> report properties
also i remember there was a InteractiveHeight Option somewhere that should be set to 0.

Set xlsx to recalculate formulae on open

I am generating xlsx files and would like to not have to compute the values of all formulae during this process.
That is, I would like to set <v> to 0 (or omit it) for cells with an <f>, and have Excel fill in the values when it is opened.
One suggestion was to have a macro run Calculate on startup, but have been unable to find a complete guide on how to do this with signed macros to avoid prompting the user. A flag you can set somewhere within the xlsx would be far better.
Edit: I'm not looking for answers that involve using Office programs to make changes. I am looking for file format details.
The Python module XlsxWriter sets the formula <v> value to 0 (unless the actual value is known) and the <calcPr> fullCalcOnLoad attribute to true in the xl/workbook.xml file:
<calcPr fullCalcOnLoad="1"/>
This works for all Excel and OpenOffice, LibreOffice, Google Docs and Gnumeric versions that I have tested.
The place it won't work is for non-spreadsheet applications that cannot re-calculate the formula value such as file viewers.
If calculation mode is set to automatic, Excel always (re)calculates workbooks on open.
So, just generate your files with calculation mode set to "Automatic".
In xl/workbook.xml, add following node to workbook node:
<calcPr calcMode="auto"/>
Also check Description of how Excel determines the current mode of calculation.
You can use macros as suggested, however you will create a less secure and less compatible workbook without avoiding user interaction to force calculation.
If you opt by using VBA, you may Application.Calculate in Workbook_Open event.
In your XML contents, simply omit the <v> entity in each cell that have a formula, this will force Ms Excel to actualize the formula whatever the Excel options are.
Instead of:
<c r="B2" s="1">
<f>SUM(A1:C1)</f>
<v>6</v>
</c>
Have:
<c r="B2" s="1">
<f>SUM(A1:C1)</f>
</c>
If you have to actualize formula in an already given XML contents, then you can code easily a small parser that search for each <c> entities. If the <c> entity has a <f> entity, then delete its <v> entity.
Faced the same problem when exporting xlsx'es via openxml (with fastest SAX + template file approach w/o zip stream rewinds).
Despite Calculation option=Automatic, no recalculation on opening the file.
Furthermore no recalculation via Calculate Now and Calculate Sheet buttons.
Only upon selecting the cell and pressing enter ;(
Original formula: SUM(A3:A999)
Solution:
Create an internal hidden sheet
Place end row number (999 in my case) into any cell in hidden sheet (P1 in my case)
Reference row number in the cell via INDIRECT operator
Final formula: SUM(A3:INDIRECT("A"&Internal!P1))
Please refer to the attached gifs
before.gif
after.gif
P.S.
Theoretically, in P1 you can implement dynamic row number calculation via smth like =LOOKUP(2;1/(Sheet1!A:A<>"");ROW(Sheet1!A:A)), but my customers were satisfied with hardcoded row number solution

ActiveReports 7 TextBox/List Page Break

I'm new to ActiveReports 7, I have a rdlx Report using a stored procedure to populate multiple lists with TextBoxes. The data is appearing correctly, however I am unable to get the TextBoxes to break when their contained data exceeds the length of the page. Instead, the TextBox remains unbroken and starts on the next page leaving a large empty gap. I have the containing Lists' 'KeepTogether' property set to 'False' and it doesn't help. How can I make these Lists and/or TextBoxes break at the end of the page and resume on the next?
Check the type of report you have. There are the "ActiveReports 7 Page Report", aka FPL (Fixed Page Layout) report and the "CPL Report" (Continuous Page Layout).
Fixed Page Layout is for creating a new page for each record. Suitable for invoices and similar reports. You need a "CPL report" so that it only adds pageas as needed for the content.
To get a CPL Report take the following steps from inside the designer in Visual Studio:
Project > Add New Item
Choose the "ActiveReports 7 Page Report" item here.
Choose Report > Convert to CPL Report.
Those steps should effectively have the effect of changing "Page" to "Body".
Below are the steps I used to create a CPL report that has a list with a textbox containing very long text (longer than a page) and it renders across pages okay:
Add a list
Add a textbox to the list. The default properties should work fine, but the relevant properties on my textbox are:
TextBox.CanGrow=True
TextBox.WrapMode=WordWrap
List.KeepTogether=False: Although technically this should be fine either way if the textbox/list are larger than a page. KeepTogether=False will just prevent it from moving to a new page if it is starting half way down the page.
Let me know if you still don't crack it and I'll upload my test report here somewhere for you.

How to change the SSRS input parameters position in report

My SSRS report contains 7 input parameters and while running my report the size of the parameter(i.e. length) is increasing.
One of my input parameter(drop down list) may contain 100 characters so the size is not constant but i want to place all parameters in 2 lines or 3 lines(in a row).
Now it is coming 2 parameters per a row
Please advice
As gbn indicates, it's not easy to change the built in report server method of presenting the parameters. SSRS likes to always use two parameters per line, presented in the order that they exist in the report (which must match the dependency order.)
So the alternatives that gbn mentions: Both involve building a "Wrapper" application: some custom code or a web page that you can code however you like to get the parameters. Then you call Reporting Services, either in code or by passing a formatted URL with your parameters. The report can be displayed in a frame, new window, or passed as a stream to where ever you'd like.
The URL access is pretty straightforward and reliable: I often use it either by hand (to create "favorites") or in code.
http://msdn.microsoft.com/en-us/library/ms153586.aspx
For what you are looking for, these might be more work than you expected, but they will be extremely flexible for your interface.
Jamie
You can certainly do that, just right click on the RDL file in the solution explorer and select view code. then move the XML tags named <ReportParameter Name="Nameofparameter"> under <ReportParameters> according to where ever you want to position. And then save it. thats it!!!
The report parameters are kind of floating in values of 2, so if u have 4 report parameters then it will be shown as 1,2 next line 3,4. Best of luck!!
Use ASP.NET for the paramaters and a ReportViewer control or URL access to render. Seriously.
I don't know of any option to present parameters any way other then the default
I believe you could try using jQuery. The report parameters are rendered in a table under a div tag with class sqlrv-ParameterContainer. Write a jQuery or JavaScript function that will extract the full innerHTML from this div ie. the table content and then extract the table row information like the <label> or <input> tags.
Create your desired table structure with <table><tr><td>{extracted sections}</td><td></td></tr></table> or leave it to your requirement...
Then just append this new HTML structure in place of the original default structure.
In jQuery it will be like
$(".sqlrv-ParameterContainer").html();
which will give you the entire table structure that comes inside the parameter. Use XML parsing and get the input controls and all. Extract these controls as-is, don't change anything.
$(".sqlrv-ParameterContainer table").remove(); // it will remove the SSRS rendered default table from DOM
$(".sqlrv-ParameterContainer table").appendChild('<table><tr>......</tr></table>'); // Append your custom html structure here....
This was something that came to my mind quickly... I would suggest you test it... :)
This doesn't help the OP with SSRS-2008 but in case it helps others - Microsoft have improved this in SSRS 2016 - parameters can now be easily managed via the GUI in Report Builder / Visual studio:
https://www.intertech.com/ssrs-parameters-2016-update/