|
Hello Johan,
Thanks alot for helping me out. I really appreciate it.
You where right it does generate an assert faillure when running in debug mode.
I made a basic dialog based app for testing it again.
All the Fields are doing fine but the grid causes an assert faillure.
The faillure says in AFXCOLL.INL line 233
------------
_AFXCOLL_INLINE CString& CStringArray::ElementAt(int nIndex)
{ ASSERT(nIndex >= 0 && nIndex < m_nSize);
return m_pData[nIndex]; }
-----------
I would like to send you my test App but i dont know your email adress.
Again i really thank you for helping me out. I would very much like to use your ReportGenerator
coz it rocks!!
Greets
Andre.
|
|
|
|
|
My address is in the e-mail link at the bottom of the message, or
johan.rosengren@telia.com
|
|
|
|
|
I need to use polish characters on report. I've created new report template and placed on it one field (with Times New Roman Central Europe). This field is then merged with polish chars i.e. "ąężć" and report is printed but without polish chars.
I've noticed that report template doesn't remember previously selected script for font (I choosed Central Europe, but if I open it again it is set To Western).
What is wrong?
Thanks a lot.
Shark
|
|
|
|
|
What is wrong is that the charset is not stored for the font - embarrassing but true. This is in the pipeline, but unfortunately, other small corrections and stuff gets in the way all the time - I'll do a serious try to get the article updated soon, however. One problem is that files already generated with the code will not be backwards compatible, something that always makes med shudder when it comes to published code, but I think I'll have to bite the bullet in this case...
|
|
|
|
|
Hello Sir
I want to thanks you about your work, but I think that your work dosn't reflect the reality. What I want to say is that in a document we need to print many pages to print the contenent of a DataSet. and for this reason we need a header and a footer for the document and a header and footer for every page in the inner pages in the document.
your work at this version resolve many problems due to the reporting but not exactly what a programmer need to see.
|
|
|
|
|
I'm not sure I get what you mean by "header" and "footer" in this context - you can indeed add header- and footer fields that will be repeated in the body of the document. That is, fields added into the body part is repeated over and over. You can also - if you need a dynamic header - load a/the template(s), fill it/them with data for the first set, print, clear it/them, and load the next set etc.
Finally, as I've published the full commented source code, a description of the classes, an UML-diagram and even a (admittedly brief) how-to, you might modify the source yourself, to fit your needs exactly. If you do a general change, no one would be happier than me to incorporate it into the main body of the code.
|
|
|
|
|
Hello Sir
what I want to say is that developper have to print DataSets, at this version your code makes a duplcate page for printing Grids but grids length may change between pages. and this is a very big problem for a developper
thanks
|
|
|
|
|
Hm, I still don't follow you - you can just teat each dataset as a separate report and print them as such.
The report generator will not, however, stop drawing the grid if all lines are not filled in on the last page - something that is most definitely on the //TODO:-list.
|
|
|
|
|
Hi,
I went thru the demo, i was getting a hang on it, until i tried other features and met with limited success. i would be glad if u could give me a demo that illustrates the following.
1. addtemplates to a single report (with the header footer and sections).
2. the working of the page number and date feature.
3. a couple of demo reports.
thanks for your time
|
|
|
|
|
I'll have to give an answer much like the one to Alex Evans below, first of all, how to set up a multi template report:
report.AddTemplate( _T( "header.rpt" ), report.TEMPLATE_TYPE_TITLE_PAGE );
report.AddTemplate( _T( "body.rpt" ), TEMPLATE_TYPE_SECTION );
report.AddTemplate( _T( "summary.rpt" ), TEMPLATE_TYPE_SUMMARY_PAGE );
CStringArray stra;
for( int t = 0 ; t < max ; t++ )
{
stra.Add( somedata);
}
report.Add( _T( "a_grid" ), stra );
report.Print();
If you add the text [%date%] into a field, it will be replaced by the current date when printing, [%page%] will do the same, but with a page number (of course). As you can see in the documentation, there are other special markers as well - some relevant only for grids.
As for a couple of demo reports, *sigh*, time is not enough, I would have to create a demo app filling them with data, and my design skills are frankly not enough to create reports with any kind of acceptable looks
|
|
|
|
|
Thanks a lot for ur time, appreciate it. I will give it a go.
cheers
|
|
|
|
|
Printing with the dialogbox is fine but printing
with CList is difficult and on the top i need to
print a text box data which is the name of the
company
thankin you
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
I must admit I'm a bit confused here (not that that's anything new). Are you refering to the normal printing of a dialog with controls? Do you want to move data from a CList to a report? A text box is easily created with the Report Creator, either as a label (where you fix the title at design time) or as a text field which you add data to at runtime.
|
|
|
|
|
Hello again
Thanks Johan for clearing my previous question. Now, I am working with a Dialog based application, the dialog is derived from some other class, and I need to print.
All the examples I found until now are one of the following:
1) They are either based on the Doc/View architecture
2) Or Dialog base, and derive the new class from CView
I am in the 2nd group but could not do this, so I only need to be able to print - you sample loop, but without VIEW, just direct printing.
Hope you can tell me what can I do to achive this?Which functions to call, or a code sample
Thanks again for your help
Alex
|
|
|
|
|
The only thing you need is a (printer) CDC, which you can get using for example CPrintDialog::CreatePrinterDC . As a matter of a fact, if you just set up the report, loading it and adding data,, calling CReportGenerator::Print (without inparams) should print the report to the default DC.
|
|
|
|
|
Hello Johan
My mistake, the fill are shows correctly in the Report-Creator preview mode, BUT not at runtime with the Report-Generator, in 6 or in .NET, in both cases te rectangular are comes up empty...
I also have another question.
When for example printing a report / Invoice - you will have some header information on the first page, but NOT on subsequent pages... So how can I control this?
An example will be appreciated
Thanks again
Alex
|
|
|
|
|
As I stated in the answer to your post below, I'll look into the rectangle stuff.
As for a separate title page, you'll want to create two templates, one for the first page, and one for the rest of the pages. Add a grid with the same name on the two templates (data you add to the report will start on the first template, and then spill over automatically repeating the second template as many times as necessary). Call AddTemplate for the two templates instead of SetReportFile .
|
|
|
|
|
Hello again
Tha nks again for your help on this, but I tried several things, and I don't seem to get it right.
Can you please give me some code sample of how to go about it, where in the loop to insert the 2nd AddTemplate?
Thanks
Alex
|
|
|
|
|
Alex,
You are not supposed to add the second template in a loop at all, rather at the beginning, together with the first page. The generator will work out what to put where.
I'll prepare a small project demonstrating this and send it directly to you.
|
|
|
|
|
Thanks Johan
Do you mean, that I need to call SetReportfile() twice... and do all the staff in the loop one after the other or what exactly?
If so, it means that I will need to calculate how many records will fit onto the first page (with the header) and continue loading Add() data from that point onwards onto the 2nd page???
Cheers
Alex
|
|
|
|
|
Even though we have sorted this out, let me answer for the benefits of others.
The report file(s) are loaded before data. For a single report file, SetReportfile is called, for multiple files, AddTemplate is used instead, so:
report.AddTemplate( _T( "header.rpt" ), report.TEMPLATE_TYPE_TITLE_PAGE );
report.AddTemplate( _T( "body.rpt" ), TEMPLATE_TYPE_SECTION );
report.AddTemplate( _T( "summary.rpt" ), TEMPLATE_TYPE_SUMMARY_PAGE );
CStringArray stra;
for( int t = 0 ; t < max ; t++ )
{
stra.Add( somedata);
}
report.Add( _T( "a_grid" ), stra );
report.Print();
|
|
|
|
|
Hello Johan
A couple of things I see, first when compiling under .NET, I get an error (but NOT under MSVC 6.0)
borderline.h(23) : error C4716: 'CBorderLine::operator=' : must return a value
On the following lines
class CBorderLine
{
public:
// Construction/destruction
CBorderLine();
virtual ~CBorderLine();
operator = ( const CBorderLine& line )
{
m_visible = line.m_visible;
m_style = line.m_style;
m_color = line.m_color;
m_thickness = line.m_thickness;
};
=====
2nd issue - when going to Print-Preview under 6.0 I get my rectangular shap filled with green, while under .NET it comes up empty... Here is the RPT file I created, maybe you can figure out what am I doing wrong?
Thanks
Alex
paper:793,1122;
report_label .718750,0.604167,4.531250,0.947917,This is the top of the report,,0,Verdana,200,0,0,0,0,32768,0,1,3317052,2,1242140;;
report_box .645833,1.468750,7.510417,1.875000,,,0,1,0.000000,0,0,1,65280;
report_grid .697917,2.489583,7.541667,11.156250,,Grid,0,1,0.000000,0,0,0,0.000000,0,0,0,0.000000,0,0,6,0.000000##0#0#0#0#0#0#0#;
report_picture:5.572917,0.552083,7.375000,1.062500,Mklogo.bmp,,0,1,0.000000,0,0,C\colon\ReportGen\Mklogo.bmp;
report_field:6.677083,2.083333,7.468750,2.291667,,InvoiceNum,0,Times New Roman,120,0,0,0,0,0,0,5,3317052,2,1944715424;;
|
|
|
|
|
Congratulations!, this work are fine
Question: How i can call generator or creator from VB6, there is way to build dll from your code, someone has dll's that i can call from vb6.
Thank you!
|
|
|
|
|
Thanks for the feedback!
On how to use from VB, I must admit being at a loss. As the data types used, CString and so on, are MFC, I assume it would be a bit tricky to build a wrapper DLL (or perhaps not), but I really don't know.
The report editor is an even bigger problem in this respect, an OCX would have to be rather extensive in wrapping the different settings and so on into properties.
I would support someone doing the effort, but know nothing at all of VB myself, and would not take on this task myself.
|
|
|
|
|
Hi Johan,
I wrote last week with a similar request.. ("Just can't believe it")
I guess that the Report Editor wouldn't be converted or wrapped, we the VB6/ASP 3.0 programmers could use it "as it is" right now. But the main goal is to wrap the Report Generator code...
I could take the risk in my free time, but off course, I will need your help. In such case, maybe this wouldn't be the right place to ask you about a specific programming task like this... If you don't mind contact me at jeanpaul_mir@cantv.net.
Regards
Jean Paul Mir V.
|
|
|
|
|