|
I created a rough MDI-project based on the SDI-demo from this article, and couldn't reproduce the problem - perhaps you could mail me a minimum project exhibiting the error for further analysis?
|
|
|
|
|
Thats all man youve made a GREAT work...
You have got a new fan!
|
|
|
|
|
Thanks a lot for the feedback - I'm getting embarassed
|
|
|
|
|
Thanks for this code very much. It helped me a lot.
I have a little question that i don't understand. Here it is:
I created grid and added some data. When data lines is more than grid lines data become ugly (writes on existing field). So how do we do that? I can't see in the doc. Is it done by sub-templates...
Thanks for any help.
dx
|
|
|
|
|
Thanks for the feedback!
The grid should continue to the next page by itself, so this might well be a bug. If you want, feel free to mail the report file to me and I'll take a look at it.
|
|
|
|
|
I find out what's the problem, i tried to print into the main window (OnDraw with m_Report.Print(pDC) and in OnPrint m_Report.PrintPage(pDC,pInfo->mCurentPage). Just erased OnDraw m_Report.Print(pDC) and everything okej(so Print(pDC) shows all pages in one), but there is nothing on the screan. Maybe i'm missing something.
If i put m_Report.PrintPage(CDC) in OnDraw it's okej(in the main window show first page).
But there is another problem (maybe it's not related with this code)when i preview in Print Prieview mode and close it everything dissapear what was in the main screan. I tried several things, but nothing helps.
p.s. i find out one thing, when the line in OnPreparePrinting --- pInfo->SetMaxPage( m_reportGenerator.CalculatePages() ); is commented everything is fine, but in preview mode shows only one page.
Thank you for any response.
dx
|
|
|
|
|
I'm scratching my head over this one. Could you mail a minimum project displaying the problem directly to me?
|
|
|
|
|
Hello all
Say I have a program - for which I have no source code, and it prints a "report" in this case it is actually a Point-Of-Sale RECEIPT going to either a SERIAL or PARALLEL printer port
I want tyo TRAP, the print Job, before it get to the port, re-package it (add some Logo, and header / footer lines) and then let go of it to the intended printer..
Can this be done? Any suggestions please (using MFC / C++)
Thanks
Alex
|
|
|
|
|
I think that this would be very, very difficult to accomplish. I assume that it is saved as a metafile by the spooler, and eventhough theoretically possible to go into a metafile, play the instructions an add more, you'll have to suspend the printjob to inject your own commands.
In your case, I would experiment by printing to file and visit www.wotsit.org for info on the metafile format (if this is indeed the format used), and search for any information on the print spooler on both www.msdn.microsoft.com as well as generally on the net.
If it's instead possible to export the report to text format, you could write a print server yourself - letting an application check a given directory for this file, printing it the way you want as soon as the file is possible to open exclusively (that is, being completely exported from the other application)
|
|
|
|
|
Hello Johan
Followed your link, did a bit of looking around, found out that my starting point should be hrough a call to AddMonitor() - but, tried this and I have no idea which DLLS I need for the INF file.
It seems that the way to go about it, is to Add a Printer monitor, intercept the call, halt the job, do something to it, then releasing the job...
Any more suggestions?
Cheers
Alex
|
|
|
|
|
Hmmm, the monitor is inserted between the final output and the port - as far as I understand, this means that you'll have to know the printer language that the printer driver is finally sending out. This will be stuff like HP:s PCL or PostScript, I assume. I think you might be investigating a too low level here. Isn't there a possibility to - for example - output to file from the application?
|
|
|
|
|
Hello again
Well, the whole point is that I am NOT the developer of that other aplication, nor do I know what print driver is used, it can be anything - I am trying to find here a genereic solution to a problem, here are the details again
1) There is a "Program" that prints to a printer
2) I have no way to check what the program is doing
3) No idea if it writes directly to the printer or through a spooler
4) I want to intercept the job, add to it something
5) While I am adding, I want to halt / pause the printer
6) When I am done adding, release the job
7) Let the printer driver do what it is expected to...
The "Interceptor" will be programmed to take some configuration parameters, depending on the printer used, port / COM / LPT etc... but the rest needs to be done in a generic way...
So, what do you think?
Cheers
Alex
|
|
|
|
|
Alex Evans wrote:
Well, the whole point is that I am NOT the developer of that other aplication, nor do I know what print driver is used, it can be anything - I am trying to find here a genereic solution to a problem
I understood that much Therefore, I think that a monitor is not what you're after.
All printers print throuhg the spooler in Windows (you could do it directly, but consider this a truth for all practical purposes). I assume that it is possible to halt and resume, but the problem is definitely to inject your own stuff into the spooler file. For this, you'll primarily have to know the format of the file, which, if memory serves, is a Windows metafile that is translated by the printer driver.
You have other options besides the above, given a minimum amount of control over the machine the program is running on. You can set the default printer to print to file, you could experiment with "installing" a basic text printer (if those drivers still exist in windows). If you can get output to a specific file - and now I don't mean through modifying the program you don't have the source for, but by experimenting with printer driver settings, you'll be able to load and modify the output. This is where I think you should spend your time investigating.
|
|
|
|
|
Each time I try to set the font of an object in the ReportEditor to a non-western script (Central European in my case), I always get Western script later when I open object's font properties. Also, the final report itself (whether in print-preview mode or printed) displays non-western characters badly.
So, are non-western font scripts supported at all, or am I doing something horribly wrong?
--
Vladimir Svrkota,
CardWare
Novi Sad, Serbia and Montenegro.
|
|
|
|
|
I hardly think you are doing anything wrong - there is nothing special prohibiting non-western fonts. If you examine the returns from the font selection dialog, does the data seem ok? If you create a MFC project from scratch, adding a font dialog, will it work ok?
|
|
|
|
|
Thanks for the answer. I looked into the source of CDrawObject and its derivates and found out that all font attributes (name, size, color, bold, italic,...) are supported, but not the charset. That's why LOGFONT structure used for drawing text is always set to western (ANSI) charset. The same thing happens with ReportCreator (DiagramEditor): MFC font selection dialog is capable of returning the font's charset, but that information is never used and therefore never stored into *.rpt file. I think fixing these little problems would make your reporting library even greater. A next release, maybe?
--
Vladimir Svrkota,
CardWare
Novi Sad, Serbia and Montenegro.
|
|
|
|
|
Vladimir Svrkota wrote:
A next release, maybe?
There will indeed be. Thanks for the time taken to sort this out!
|
|
|
|
|
it is very good!
I test a sample with two sub-table in multi-page,
what i want is :
the first sub-table, is only lay in the first page,
the second sub-table cross the first and the second page,
but the fact is :
the first sub-table display one the second page, too.
it looks very ugly.
how to do ?
|
|
|
|
|
This should indeed be possible, but very difficult answering without seeing some data. But if the first table is unrelated to the second, this will be the effect. That is, if you have a table with the id Name1 on the first sub-page, and one with Name2 on the second, Name1 can render 50 lines and you fill it with 51 lines, it will not start to fill Name2 . To accomplish this, you'll have to name the second table Name1 as well.
If this is the case, feel free to mail your report files to me, and I'll take a look at it.
|
|
|
|
|
Johan Rosengren wrote: on the first sub-page
What are sub-pages?
~~~~~~~~~~~~~~~
CDRom
|
|
|
|
|
Page of the multi-page template. That is, not pages as in the printed report, but rather in the temlpate
|
|
|
|
|
hi there,
i am really curious if i can expose all these classes and their functionality through VB.net.
is there a DLL that i can include or something in vb.net to gain access thru vb
really i know nothing about c, c++, c#
thx in advance
Maged A. Reda
|
|
|
|
|
I, on the other hand, know very little about VB/VB.net.
I assume that it is possible, at least the report generator part, but there would have to be an access-layer around the generator, as it uses the MFC-specific data classes CString and CStringArray to set information. Anyone interested in giving it a try? I have, as stated, too little experience of VB.
|
|
|
|
|
I want to republish this article and others projects of you (total 10). In the articles you give general permission to use it any way. So, I think it is ok. Looking for your comment.
Tomorrow is a blank page
www.kuashalabs.com
|
|
|
|
|
You can even take the code and put your name in all the files, stating that you wrote it.
This liberal licence is not because I'm crazy, it is for the simple reason that I rather prefer the code to be used (in my monstrous megalomania) than just sitting on a site somewhere, and I know than many companies have concerns using anything that in the slightest way can be a risk, copyright- or ownershipwise.
Note, however, that I maintain the code, and it is actually updated every now and then (for the moment, there is for example implemented a Redo-function in the underlying CDiagramEditor ) - you might either want to keep an eye on the articles themselves, keep in contact with me or just keep this in mind , whatever is appropriate in your situation.
|
|
|
|
|