What is the best reporting mechanism!  [SOLVED]

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
tomay3000
Experienced Solver
Experienced Solver
Posts: 90
Joined: Mon Apr 24, 2017 4:23 am

What is the best reporting mechanism!

Postby tomay3000 » Wed Jan 10, 2018 3:23 pm

Hello,
It would be very nice if only wxWidgets have OpenXML SDK alike for C++ reporting, but unfortunately OpenXML is for .Net development
whereas wxHtmlEasyPrinting is very limited, it is useful for static templates only.
What if I want to print an undefined number of rows from the database in HTML format, what is the solution then ?
Thank you for your understanding.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2787
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: What is the best reporting mechanism!

Postby ONEEYEMAN » Wed Jan 10, 2018 5:18 pm

Hi,
Well, there is an XML parser in wxWidgets, but I guess you are looking for something more...

Thank you.

User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: What is the best reporting mechanism!

Postby eranon » Wed Jan 10, 2018 7:53 pm

Hello, It's not clear (what you want) for me... Do you want to parse an XML file, generate an HTML one or print it?
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]

tomay3000
Experienced Solver
Experienced Solver
Posts: 90
Joined: Mon Apr 24, 2017 4:23 am

Re: What is the best reporting mechanism!

Postby tomay3000 » Wed Jan 10, 2018 10:46 pm

Well, What I want exactly is reporting like "SAP Crystal Reports" or "Fast Reports" for printing, so my first thought was about preparing the report template using Office and choose placeholders in the document that should be replaced with the database record values (like @[email protected], @[email protected], @[email protected], @[email protected] and so on), since a .docx document is actually a zip compressed file containing xml files that contains the actual values to be replaced (I open the .docx file which is actually a .zip file, then open the .xml file containing the data to be replaced (@[email protected], @[email protected], ...), then get the record values that should be previewed from the database, then do a search and replace of all the placeholders, and finally print-preview or print the document). This method is complex and difficult to implement.
So I went for a different approach when I discovered wxHtmlEasyPrinting, which implies preparing the report template (the preview) with HTML rather than a .docx office file.
I find wxHtmlEasyPrinting much more simpler, but it is very limited.

The problem here, is what to do about reports that have dynamic (no static), (no defined) number of HTML table rows on reports that contains tables?

Or are there any easy to use, updated reporting system (SDK) for wxWidgets I don't see ?

Thank you for your understanding.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2787
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: What is the best reporting mechanism!

Postby ONEEYEMAN » Wed Jan 10, 2018 11:08 pm

Hi,
Yes, docx files are a zip files that contains some XML.
However Word documents are probably not what you want since reporting the data is not the same as Word processor.
wxHTMLEasyPrinting is limited in that it supports only HTML 4 limited set of tags.

You may try to look at the wxWebView for form generation and then use printing capabilities of the browser.
Or you can try to create some web page with placeholders and just run the query and placing the data on that page.

But you will still need either the external browser or wxWebView.

Unfortunately there is no CrystalReport-like/PowerBuilder-like/Access-like software written with wxWidgets.
You can try executing Access as an external program and run the appropriate report with the data retrieved. But this is Windows-only solution.
You can also install MS Office on OSX and use Access there to generate an appropriate report.

Unfortunately I don't think anything is freely available for Linux.

Thank you.

User avatar
eranon
Can't get richer than this
Can't get richer than this
Posts: 867
Joined: Sun May 13, 2012 11:42 pm
Location: France
Contact:

Re: What is the best reporting mechanism!  [SOLVED]

Postby eranon » Thu Jan 11, 2018 4:27 pm

I think you overthink the topic, tomay3000.

A simple HTML template with three parts: header, row, footer, then you duplicate populated row as many time as necessary. At the end, you concatenate these three parts in a wxHtmlWindow (lighter than wxWebView which become really necessary if your report is with complexe layout and/or need for javascript).

Another direction would be to populate a wxRichTextCtrl, but even if the implementation would be different, the main logic remains the same : template with fixed and variable parts...

And, of course, as ONEEYEMAN, I think you should forget the docx (unless you want to produce final document for sharing with persons supposed to load it in Word, WPS Writer, etc.)
[Ind. dev. - wxWidgets 3.0/3.1 under "Win 7 64-bit, TDM64-GCC" + "OS X 10.9, LLVM Clang"]

tomay3000
Experienced Solver
Experienced Solver
Posts: 90
Joined: Mon Apr 24, 2017 4:23 am

Re: What is the best reporting mechanism!

Postby tomay3000 » Thu Jan 11, 2018 11:52 pm

Well, I guess HTML (using wxHtmlEasyPrinting or wxHtmlWindow sticking with only HTML 4 will do the job) will be the best approach to implement Reports, and you are right, I should forget about .docx files.
Whereas for the three parts of the HTML template, I guess I will implement another approach, which is as follows:
1) Create 1 Single HTML template which will be the final report view.
2) Define BEGIN and END marker variables for dynamic parts like tables. (@[email protected], @[email protected], ...).
3) Get the SQL database rows data upon the search criteria into a C++ defined variables.
4) Load the HTML template from resources or file storage into a wxString.
5) Do a search and Replace in the HTML string.
6) Delete every BEGIN and END marker, because we defined them for the dynamic parts purpose.

Thank you all for the support you provide ;)


Return to “General Development”

Who is online

Users browsing this forum: No registered users and 5 guests