|
Now, I'm not 100% sure I get your question - you will not have a page length on a continous roll ???
If you have a roll of labels, and want to know the height of each label, it's of course easiest to look at the package If you need to know the height of the label expressed as addressable pixels, you call GetDeviceCaps for the printer CDC , and just hope that the paper size is set correctly. I feel I'm just being silly here, could you elaborate on the question?
|
|
|
|
|
Sorry for not making my question clear. Let me try again.
In ReportCreator, I create a label that is 2 inch in height and 4 inch in width. When I print with ReportGenerator to an impact printer (Epson FX-86e), the printer eject or form feed to the top of next page after finish printing a label. How to control so the printer advance to the top of next label.
Thanks again.
|
|
|
|
|
As you can see from the source code, the report generator uses the GDI print commands to handle pages, that is, the sequence to print is
StartDoc
StartPage
EndPage
EndDoc
This is true also for the underlying MFC framework (if you use the print preview mechanism as outlined in the demo).
EndPage in this case will send a form feed to the printer, and what happens will depend on the printer settings. What I would try in your case was setting up the printer to have a custom page size - in the printer settings - corresponding to the height of the labels.
This can be accomplished in code as well, using the DEVMODE structure. First the definition of the structure: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_8nle.asp[^]. You might want to experiment with, for example, ResetDC[^] to set your own values into this structure.
|
|
|
|
|
Great work! I come from China, welcome you to come my contury.
|
|
|
|
|
Thanks! A bit far away, but heartwarming anyway
|
|
|
|
|
May be, I don't understand how to perform a page jump or how to create more than one page with the Creator programm. Could you help me ?
Rabiby
|
|
|
|
|
The editor creates single page templates only, so you'll have to create one template for each page. But beware, the report generator is also geared towards single page templates (but of course not print-outs). You can load several templates, by for example having several instances of the generator, or load it with a new template for each page, but you'll not get the print preview this way.
I might updtae the generator to work with several templates (I would at least want to have a separate first and last page), but I will not update the template editor for this - it will still be one page, one template.
|
|
|
|
|
Hi, Thanks for the Nice Artical.
You need to convert the HBITMAP for PriterDC before sending it to
printer.
|
|
|
|
|
Hm, don't I do this already? Be how it will with that, I'm currently changing machines here, and will test and double test as soon as I'm comfortably set up again!
|
|
|
|
|
I think I found the problem in CReportEntityPicture::SetFilename(), in the following statement:
m_bitmap = ( HBITMAP ) ::LoadImage( NULL, m_filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTCOLOR );
I replaced the flag LR_DEFAULTCOLOR in parameter 6 above with LR_CREATEDIBSECTION to the following and it works!
m_bitmap = ( HBITMAP ) ::LoadImage( NULL, m_filename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION );
Thanks for this great article!
|
|
|
|
|
And I who even made a report with a bitmap and tested it... Thanks for the help! The correction will go into the codebase at the soonest possible time.
|
|
|
|
|
I'd just to say you that your codes are simply genious.
I noticed that in spite of my many years of experience, I'm still a beginner compared to you.
Thank'a a lot for sharing a such of work.
Rabiby
|
|
|
|
|
Let's not create an inflation in words I'm certainly no genius, and I also have a few years of experience. But big thanks for the kind words!
|
|
|
|
|
My god, I noticed this project yesterday, the functionality style is familiar, especially the handling of text file, like your UML Editor etc, but I did not notice that author's name. I revisit this project today and notice that it IS your project, wow, you genius crazy! You REALLY type FAST
Excellent coding!
btw:
1.any idea of data-binding? I mean it can automatically accept a data source and bind data to corresponding fields, I know it is hard
2.Editor binary file download?
Regards,
unruledboy@hotmail.com
|
|
|
|
|
Yes, it's me again By the end of 2005, I will have written half of the articles on CodeProject. Then it will be a fulltime job just to maintain the code
Unruled Boy wrote:
1.any idea of data-binding?
I want to avoid tying the code to any specific type of data source, but I'll try to make the data feed more flexible. Perhaps also example code on how to pulg this together with a database - but my last efforts in this direction using MFC was with CRecordSet s...
Unruled Boy wrote:
2.Editor binary file download?
Elaborate on this, you just lost me
|
|
|
|
|
Hey, WOW is an obvious response to the effort & result you pulled here!!!
still, i think you made a bad choice of creating a propietary format of template files. had you choosen xml file, the sky was the limit.
this is a much needed package, and conforming with common protocols would have promoted this package a great deal, for instance I think that it would have been a lot easier to create a better template designer (A.K.A ReportCreator ) in C# - Winforms and save it to xml.
nevertheless,
striking and much needed!
great job, really.
DaberElay.
|
|
|
|
|
Thanks for the feedback!
As for the format, this is the same format I've used for the editor, which is derived from my CDiagramEditor (also published here). Having this format is for the simple reason to keep the parsing uncomplicated. Otherwise I would either have to have added an XML-parser to CDiagramEditor , which, while certainly not being rocket-science, was a bit outside the scope of that project, or use someone elses code, which would have defeated the current simple integration into other projects (in addition to difficulties finding other free software with the same lunatic licence I grant for users of mine )
But I think I'll add a "feeder"-function, where the proprietary format can be fed from memory instead of a file, then you can add XML-support to your heart's content!
Remember that you also have access to the full commented source code, nothing stops you from ripping my code, rewrite what you like and create a new article. Or sell it. Or whatever
|
|
|
|
|
Hey Johan! Ya know, it's really not fair. The stuff you post on CodeProject is better than the stuff I do for a living. Sort of makes me want to just open up a small all-night store
Sorry, I only gave you a five. I don't need this (at least not yet), but it's nice piece of work.
Sheesh! I guess I'll go check out the classifieds for a nice vacant shop somewhere.
All the best!
|
|
|
|
|
You should see the stuff *I* do for a living Thanks for the feedback!
|
|
|
|
|
Somebody has just dialed 911 for me
I have just been exposed to a five-star knock-you-out article.
Don't know much < I, don't care much > I, while I am here ... just be happy
|
|
|
|
|
That was never my intention, I'll have to learn to hold back for the next article
|
|
|
|
|
Thanks for your great job. It's wonderfull. I have been looking for something similar for a while. I think it's going to help me in a project for a database engined report document. I thin I'll make you some questions about your work. Anyway, thanks for all.
|
|
|
|
|
Thanks for the nice feedback! And you are of course welcome with any questions you might have.
|
|
|
|
|
I see you have quite the same age and backgroud as I have, C64 seems to be a good starting point for many of us
I've been using Crystal Reports for quite a long time now (since 1994) in different VB or .NET projects. I can't say I'm tired if this product but there should always be place for this kind of free lunches! What keep us using CR is the easy design and the strong support for different export formats (PDF, RTF Excel...). The bad thing with CR is at the same time a strength too, it's a very big product with many versions/licenses
As you know MS launched their report generator in SQL2000 I think, and now it's called "report sevices" or something in SQL2005. Have you looked something into that? What RG:s have you been using?
Another question, can I build what I call dynamic reports with your RG? I want to design an easy report template, load it in runtime, add data fields, groupings, formatting rules and so on at runtime? If I want to to this properly with CR I have to buy their expensive enterprise version, which use is intended of course to the enterprise company.
PS. Kul att se att det skrivs bra artiklar av svenskar här.
Greetings
/Håkan N.
------------------------------------------------
- Bachelor in systems analysis 1991
- Systems developer, C#, Java, C, VB3-6
- DBA, database design, SQL, admin
------------------------------------------------
|
|
|
|
|
Håkan Nilsson wrote:
I see you have quite the same age and backgroud as I have, C64 seems to be a good starting point for many of us
I would - in addition to the old trustworthy C64 - like to mention Ramones and Kant as a good base for software development
Håkan Nilsson wrote:
Have you looked something into that? What RG:s have you been using?
I've not used any RG:s, to be honest. Either, I've worked with projects not needing them, or projects having proprietary solutions.
Håkan Nilsson wrote:
Another question, can I build what I call dynamic reports with your RG?
As the source code is included - of course But for the time being, you would have to do it by deriving a class from CReportGenerator , adding members to create new objects. You might want to look how the objects are created now, and feed string representations of the dynamic objects into the generator in a similar fashion, for example.
But this is of course much too cumbersome, the idea to be able to add fields during runtime is a good one, and I'll most certainly add it for the next update of the article (or first in this case).
Håkan Nilsson wrote:
PS. Kul att se att det skrivs bra artiklar av svenskar här.
Vi får ju visa anglosaxarna var skåpet skall stå
|
|
|
|
|