|
Hi!Well done for the amazing 'generator'.My question is how to print preview the form or report I created in normal view before it goes to print.The OnPrint() function just showed the report viewed, different with the printed form or report.Please give me some examples.Thanks.
|
|
|
|
|
As a matter of a fact, the demo contains an implementation of a print preview. Please note that there will always be differences between the printer and the print preview, the different resolution and sizes not being evenly dividable.
|
|
|
|
|
Hi.Thanks for the explanation.Actually I want to know if there's any way to preview the report in my program instead of just printing it.The report can be viewed on dialog that called from my program.The report displayed should be the same with the printed report.Thanks.
|
|
|
|
|
As stated, the demo contains an example on how to do this. If you check the documentation, you can see that you can print the report to any CDC, this will of course also include a window on a dialog or whatever.
|
|
|
|
|
Hello,
I have an rpt file that in the ReportCreator.exe program prints much different than when I print the report through my application. One area of difference is the width on the report is larger in my application print and this causes truncation on some printers.
Also, I compare the Arial 12pt. Bold font between the two print outs and they are different and if I then compare them to that produced by MS Word this appears different still.
I'm a little concern about this as I'm preparing to starting distributing my little application. Any thoughts on this matter would be helpful!
Thanks,
P.S., I have enjoyed using this print utility.
|
|
|
|
|
Right away, nothing comes to mind that could be the problem. If you send me the rpt-file directly (there is an email link at the bottom of this reply), I'll take a look at it, doing a few comparative tests.
|
|
|
|
|
Hello,
I made sure that I had the latest release and this did help some. But the report still had problems. Part of the problem was indeed how wide the report was. I went through the process of recreating the rpt file using a different font and along the way things started to work much better.
Thanks again for a fine piece of work.
Gordon
|
|
|
|
|
I will - anyway - take a look at this during the weekend.
|
|
|
|
|
When checking the template, it does indeed look like the report should fit on a page, the print preview in the report creator is supporting this assumption. In the generator, however, some information is cut towards the right edge of the paper, visible in the print preview of the demo application.
If, however, the margins are turned on in the report creator (Layout | Settings | Show margins), we can see that the fields to the right are overwriting the margin. I assume that by resizing the right-most fields, the report will print as expected.
Note that many printers have a fixed margin, to allow a grip on the paper while feeding it through the mechanism.
|
|
|
|
|
I sort of found all this out after the first email. In recreating the report I turned on the margins and noticed that fields of the report were outside the margins. It is good practice to turn these margins on to ensure that your fields and grids fall within the margins.
I really appreciate your taking a look at this.
Gordon.
|
|
|
|
|
I have more objects than one page in one template,but one page can be printed.How to print all pages in one template? Thank you!
|
|
|
|
|
There is no support for multipage templates, you'll just have to split them in several individual pages.
|
|
|
|
|
Hi,
Is it possible to do something like the following:-
Have an (e.g.) A4 sized template, A.
Have multiple smaller sized templates, B, C, D.
Load A via SetReportfile.
Load B via AddTemplate and then position it to appear in page A at a specified place.
Ditto for C and D, etc, etc.
I.E. B, C and D are regions that appear on a specified page or all pages, but they can be designed in the report creator as individual templates.
If this is possible it would provide greater design flexibility and ease, and element re-use.
Many thanks for all your hard work!
Richard
|
|
|
|
|
In code, this would be trivial to accomplish, just add objects to a given template. Selecting the appropriate template is however a little bit more complicated. Best would of course have to have a specific draw object that loads another template, this would be implemented in CFieldFactory where this hypothetical "CDrawTemplate" would - if instantiated - continue to create objects until the template is read through. It's indeed doable, perhaps you volonteer?
|
|
|
|
|
Heh, OK, I'll volunteer, but due to workload don't expect miracles (or indeed anything for a while).
If its ok can you email me at richard at vale-tech dot co dot uk and I'll be in touch with questions when I've had a chance to familiarise myself with the class designs?
Cheers,
Richard
|
|
|
|
|
Trying to create a report where each page has the same template (of type TEMPLATE_TYPE_SECTION) :
for( int j = 0; j < nPages; j++ )
{
pReport->AddTemplate( sTitleFile, TEMPLATE_TYPE_SECTION );
int max = pReport->GetTemplateSize( j );
for( int i = 0; i < max; i++ )
{
sField = pReport->GetFieldName(i, j);
iType = pReport->GetFieldType( sField, j );
if( iType == FIELD_TYPE_FIELD )
{
// Perform fields substitution here
pReport->Add( sField, s );
}
}
}
and not being able to find a solution, I've modified CReportGenerator, changing the Add method for fields from
BOOL Add( const CString & field, const CString & data );
to
BOOL CReportGenerator::Add( const CString & field, const CString & data, int tplate = -1 );
and, inside the method, changed
CDrawField* obj = dynamic_cast< CDrawField* >( GetObject( field ) );
with
CDrawField* obj = dynamic_cast< CDrawField* >( GetObject( field, tplate ) );
so now I can use the Add method in this way
pReport->Add( sField, sValue, iTemplateNo );
indicating in which template the field has to be substituted.
|
|
|
|
|
I'm not sure I follow what you are trying to accomplish - to have a report where each page uses the same template is already catered for? The latter part of you post seems to indicate that you have several templates, could you please elaborate?
|
|
|
|
|
May be this features is just provided (to have a report where each page uses the same template), but I did not know how to accomplish that with a template whit no grids which could span through pages.
However, using different templates for each page, which may have fields with the same name, and do a fields substitution targeting a single template/field pair was not possible , without changing the Add method.
May be I am wrong !
|
|
|
|
|
For what I assume you want to do, I would actually go for a much simpler solution. For single-template printouts, I would load the template, and then start to loop that data to print out. for each instance of the data, I would do a Clear (which clears the data, but not the template), fill the fields and then a Print.
If I would use different templates, I would most definitely treat them as separate reports, loading a template, setting data, printing etc. in a loop until the data was exhausted. To have a collection of different templates in the way I understand you like to do is not supported (that is, where you chose what template to add data to - I assume you also want to selectively print out data).
|
|
|
|
|
I can't understand how column' widths in a grid work !
When adding a column into a grid the width proposed is "1.#J" which I don't know the meaning.
When confirmed, in the listbox, that column has a width of "0.99".
If I try to change this width, and confirm the same value ("0.99"), then, in the listbox, the width change to "1.02".
I'm a bit perplexed !
How does it works ?
Thanks
|
|
|
|
|
1.#J is an uninitial value of some kind, plainly a bug. That the value gets a little bit different depends on the measurements set - internally, inches are used (as they are the standard in the typographical business), and there will be rounding errors between this and centimeters/pixels.
|
|
|
|
|
Hi,
First, excellent code.
I have notice the same problem, it happens only when measurement is in centimeters.
Also when enter the value for the column width (in centimeters) in the size value shows 1/"Entered value", i.e.:
Entered value = 5, size shows 0.2 (1/5 = 0.2)
Entered value = 3, size shows 0.33 (1/3 = 0.3333...)
Entered value = 10, size shows 0.1 (1/10)
The problem is in CUnitConversion::PixelsToCentimeters method
return pixelspercentimeter / static_cast< double >( pixels );
It should be
return static_cast< double >( pixels )/pixelspercentimeter ;
Thanks, Great work.
Habetis bona deum
|
|
|
|
|
It a nice code but I try to test Compile ReportGeneratorDemo (I download and Run it ok.) after I create report file (rpt1.rpt) by ReportCreator.exe and save rpt1.rpt file to folder c:\rpt and add image type bmp name logo.bmp
if open report in reportCreator it can see image on print preiview
but I open rpt1.rpt in ReportGeneratorDemo (source code and build it)
It work only when run CFiledialog before set SetReportfile function
I modify this
....
CFileDialog dlg( TRUE, _T( "rpt" ), _T( "*.rpt" ) );
dlg.DoModal();
// Only DomoDal but not select rpt1.rpt ()
CString strstrRptFile;
strRptFile.Format("c:\\rpt\\RPT1.rpt");
if( m_reportGenerator.SetReportfile( strRptFile ) )
{
....
}
It can show any things ok
but if you comment dlg.DoModal(); or show domodal but click cancel
It can show any label and filed but not show image
Why??
I must sure image file is same locate in folder rpt
Thanks
kritsakon.
|
|
|
|
|
kritsakon,
I recommend that you download an read the documentation, it took quite som time to write
You'll find the following information on images:
Images
Image objects will draw images on the report. Only BMP:s and DIB:s are supported, and they must be located in the same directory as the template during printout. Although this is not necessary during editing, it might be easiest to save the template to the same location from the beginning. When loaded with a picture, the image object will resize itself to the size of the picture. It can be resised to the desired size the same way as any other object.
|
|
|
|
|
... but I don´t know what it is
Here are the steps to reproduce it:
Make a sample report with two grids: one small at the top (say, 3 lines), one over the rest of the page.
Open the report in the demo exe an provide, say, 55 lines for the first grid, 555 lines for the second grid.
Scroll to the end -> crash.
Another thing:
I can´t figure out how to setup a master/detail report.
Things should look like this:
Header
Master Grid
Detail Grid
Detail Grid
Detail Grid
Master Grid
Detail Grid
...
Footer
Think you got it.
yoko
|
|
|
|