Most would suggest using one of the many XML editors to create a customized RDLC XML, according to user selections, and passing that report to Microsoft's Report Viewer object. I currently implement this method in previous version of my code. However, it is messy, long and lacks eloquence to say the least.
Previous research, I can't remember exactly where I saw it, has led me to believe there is a method to create a data-set, dynamically through code, create an adapter to fill the data-set, and then have that dataset.writeXML() to produce a fully functional copy of XML that can be passed to the Microsoft Report Viewer object.
Again to clarify, I do not want to use XML classes to write my report up. I want to build my dataset through code depending on user selection, have the dataset write out the XML and then pass that to the Reporting object.
A lot of the stuff I've found favors ASP.NET for some reason and I have yet to fully verse myself in its workings.
It seems that what I'm trying to do is write out the RDL (Report Definition Language). This RDL is a set of tags that the Microsoft Report Viewer interprets in order to produce a viewable object to the end user. A data-set is an element of that RDL definition so it really can't produce the RDL itself. Kind of like a baby giving birth to a mama. Here are some excellent resources I found that shed insight into the elements of an RDL file.
Here
Related
Is it possible to convert file into PDF directly from Informix?
Is there a command for it? If its not possible, then what should I do?
For example: I want to convert file sm2026.4gl into PDF.
I'm not sure if I understand the problem correctly, it looks like you're trying to get a PDF version of a 4GL program, which doesn't make any sense. There are any number of free websites that can do this for you.
If, however, you're asking how to get a 4GL report to generate a PDF, that's a considerably more interesting problem. Informix-4GL will not write a PDF file natively. If I remember correctly, 4Js Genero will, and Querix Lycia might.
However, on Linux, there is a PDF printer driver (cups-pdf) that will output the report to a PDF file.
Implementation of this is left as an exercise to the reader. :-)
There are a number of options available to you. What you choose will depend on how much time and money you are prepared to invest. The more you are prepared to invest, the better reports you will get
Do a google search for scripts/executables that will take a text file and convert to PDF. Examples include txt2pdf. These work on any text files and so are independent of the 4gl. You would amend your 4gl code to execute this via RUN immediately after your FINISH REPORT
Write 4gl libraries to create valid PDF output. That involves you reading the PDF manuals to see the structure required in a PDF file. The first line of the resulting file will begin "%PDF". This is a lot of work, I did it 15-20 years ago, I wouldn't do it again unless you want the control and independence this gives you.
Using a product such as FourJs Genero that will allow you to use your existing 4gl code to create PDF reports directly. At its simplest this involves adding a couple of lines prior to your START REPORT and leaving the REPORT statement intact. The report will use a monospaced font and look like your existing report, only it is a PDF instead of a TXT file.
IF fgl_report_loadCurrentSettings(NULL) THEN -- simple compatibility mode
CALL fgl_report_selectDevice("PDF") -- indicates PDF
... -- optional calls to indicate filename, paper, printer and other options if required
LET grw = fgl_report_commitCurrentSettings()
START REPORT report-name TO XML HANDLER grw
Using this option there are a few extra config options that are available such as adding watermarks/logos to every page that the free tools you find might not provide
The more feature rich option using FourJs Genero Report Writer involves stripping out any layout information from your 4gl code and designing the layout of the report in a WYSIWYG designer. Your 4gl code that gathers the data from the database and the functions that formulate the output is untouched. The REPORT statement no longer requires the layout information such as COLUMN 10, SKIP TO TOP OF PAGE, and that can be removed. The WYSIWYG design of the report controls the layout including full range of properties such as font, font attributes, positioning, page breaks, page numbering, images. So your 4gl code becomes
-- Report
-- No layout information in report, only need to gather and formulate data
REPORT report-name ...
BEFORE GROUP OF invoice
PRINT invoice.*
ON EVERY ROW
PRINT invoice_line.*
AFTER GROUP OF invoice
LET invoice_total.net = GROUP SUM(...)
PRINT invoice_total.*
END REPORT
...
-- Produce report
IF fgl_report_loadCurrentSettings("reportdesign.4rp") THEN -- load the WYSIWYG design
CALL fgl_report_selectDevice("PDF") -- indicates PDF
... -- calls to indicate filename, paper, printer and other options if required
LET grw = fgl_report_commitCurrentSettings()
START REPORT report-name TO XML HANDLER grw
As shown there are a number of options available to you. As to what you should do, that depends on what your goal is, and how much time and money you are prepared to invest to achieve that goal.
I want to be able to create dynamic, the xml file with report definition files rdlc for reportviewer control in
System.Windows.Form.
To do this I need the complete documentation of xml structure of the rdlc file.
It's somebody can help me?
I found already the fallowing links:
The best link is :http://technet.microsoft.com/en-us/library/ms170667(v=sql.105).aspx
but, is for an particular report. I need something more general, but no complicate like :http://msdn.microsoft.com/en-us/library/dd297486%28SQL.100%29.aspx
I found an article which look good enough for what I need.
http://msdn.microsoft.com/en-us/library/ee240083(v=sql.105).aspx
I'm passing a parameter to my .rdlc file, which is working properly. What I can't figure out is how to then use that parameter in the query the reports dataset uses. How can I use this parameter in the query?
I'm designing it in Visual Studio 2008. If there is some other method I'm not aware of, please suggest that also. I want to keep the report as un-coupled with the program as possible so I can reuse it.
The only answer I can find is that this is not how reporting services works. You must give it a dataset at runtime which has the same schema as the dataset used at design time.
I was expecting (and hoping for) a similar behavior to Crystal Reports, where you can open a stand-alone report file and be prompted for parameters, and then embed that same report into an application and pass it parameters programatically. Reports are more portable that way, but if its not possible...
I've been asked to write a program which generates reports in the form of PDF files. There are two main dynamic features which have been asked for, which I'm not sure are even possible:
1) The report contains a table with several columns. Users should be able to click on the column header to sort the table rows by the values in that column.
I've never seen a PDF file that users can click on to re-sort table results, but I'm told that this is possible.
2) The report should have a dropdown box which users can select to toggle which rows of the table are displayed or hidden.
I'm fairly sure that this isn't possible to do in a PDF file, though I've been told otherwise.
So my question is, which of these things are even possible, and what library should I use for generating PDF files? (The library can be in any programming language.)
Don't use PDF as a substitute for html/CSS/JavaScript/etc. PDF is best when it's used as an immutable document format, not as a poor man's web page. Sure, you can put your foot in a box and call it a shoe, but it's really just a box.
Have a look at
Sorting tables in dynamic PDF on the Adobe Developer Connection website.
You can also download a ready-to-study sample PDF with that feature built in.
I would look at Acrobat. There is a JavaScript implementation for it.
http://www.adobe.com/devnet/acrobat/javascript.html
For Java there are the following tools / libraries that are very good and stable:
JasperReports - you design your report in a graphical designer and then populate it with data programatically.
The other is iText. It works on the lower lavel (actualy JasperReports is built on top of it for the PDF part), so it might support the requested sorting options.
Yes, all of those dynamic features are possible with an XFA PDF form (created in LiveCycle Designer) and scripting ( JavaScript). We have examples of sorting rows in tables and hiding and showing sub-forms at http://www.pdfscripting.com , but you must be a member to access them (not free). You may be able to find free sample files doing an internet search for XFA PDFs or LiveCycle Designer PDFs- not sure but it is possible at any rate.
Dimitri
WindJack Solutions
http://www.windjack.com
I want to be able to generate a highly graphical (with lots of text content as well) PDF file from data that I might have in a database or xml or any other structured form.
Currently our graphic designer creates these PDF files in Photoshop manually after getting the content as a MS Word Document. But usually, there are more than 20 revisions of the content; small changes here and there, spelling corrections, etc.
The 2 disadvantages are:
1) The graphic designer's time is unnecessarily occupied. The first version is the only one he/she should have to work on.
2) The PDF file becomes the document which now has the final revised content, and the initial content is out of sync with it. So if the initial content needs to be somewhere else (like on a website), we need to recreate it from the PDF file.
Generating the PDF file will help me solve both these problems. Perhaps some way in which the graphic designer creates a "Template" and then puts in tags/holders and maps these tags/holders to the relevant data.
Thanks :-)
There are some tools out there for doing this. XSL-FO is useful. Here is a tutorial for creating a pdf from xml (or xhtml) with cocoon. Also see Apache FOP.
You could format your SQL data as XML and still use the same templates this way.
I use the ReportLab python library for this. It could perhaps solve your problem, but you will need to do some work...
In the past I have written scripts that spit out LaTeX then used texi2pdf to solve this kind of problem.
Take a look at iReport and JasperReports at http://jasperforge.org.
iReport lets you design reports, and then you can either programatically fill it with the JasperReports library (Java), or just use iReport to manually create the report.
I have only used it for tabular data, but I don't think there would be any problem for other types of documents.
You could create a form and populate the entries programmatically using a pdf library like iText (Java).
You could look at doing the workflow in PostScript which is plain text that you can easily compose from fragments. Then you can use any free tool to convert to PDF.
Take a look at Prince XML. This tool allows to generate PDF based on XML or HTML and CSS.
A possible way is to use a template engine, like FreeMarker or StringTemplate: these are often used to generate HTML, but they are flexible enough to output any format, actually.
The problem is to make a PDF template, I suppose. Perhaps you can take a sample output and edit it to replace data with placeholders to be filled by the template engine. Might not be trivial!
Sounds like a job that SQL Server Reporting Services can handle quite easily.
Reporting Services allows you to query the data, define the layout, and export to PDF without any intervention. The PDF output can be distributed via email, stored on a file share, and accessed via a page on the report server.
It can handle XML data sources too.
Another approach to generating a PDF file from data is to use prawn, which is based on ruby. I was very pleasantly surprised by how much functionality is included in prawn. It may take some investment up front but this approach will give you a lot of flexibility.
You can combine CSStoXSLFO with XEP from RenderX for high quality output. With this solution you can merge XML data into an XHTML template, which is decorated with CSS. It can also generate charts with the fantastic JFreeChart library. CSS3 page media features are supported.