Print Page | Close Window

Printing Report Control embedded in a Dialog

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Report Control
Forum Description: Topics Related to Codejock Report Control
URL: http://forum.codejock.com/forum_posts.asp?TID=13810
Printed Date: 27 April 2024 at 2:43am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Printing Report Control embedded in a Dialog
Posted By: Algae
Subject: Printing Report Control embedded in a Dialog
Date Posted: 25 March 2009 at 3:14pm
Does anyone know if v. 13 supports printing the list report when the report control is embedded in a dialog?

From a view, of course, printing works fine (except the squished columns when your list has a lot of columns). I have an older version, 10.4, and it doesn't appear to have the capability. I nearly have it working, but the contents appear microscopic in the printout.  If v. 13 supports this, then I can put away my magnifying glass.



Replies:
Posted By: mdoubson
Date Posted: 25 March 2009 at 10:43pm
Consider attached sample with Calendar inside dialog - it allow to print using 2 helper files - DialgoPrintHelper.cpp and .h
Code OnFilePrint - inside CalendarOnDialogDlg.cpp
 
https://forum.codejock.com/uploads/temp/20090325_224348_CalendarOnDialo.rar - https://forum.codejock.com/uploads/temp/20090325_224348_CalendarOnDialo.rar
 
 


-------------
Mark Doubson, Ph.D.


Posted By: Algae
Date Posted: 25 March 2009 at 11:43pm
Thank you mdoubson. 

It was nice to get a reply so quickly. I solved my microscopic print. I liked your solution of the print helper though. Very good! My fix was much more of a kludge. I tried to retain as much of the original report print code as possible. I reset the print mode, and rect info in the derived report control class:

class CReportForDialog : public CXTPReportControl

void CReportForDialog::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
    if (!pDC || !pInfo)
        return;

    UINT nPage = pInfo->m_nCurPage;
    ASSERT(nPage <= (UINT)m_aPageStart.GetSize());
    UINT nIndex = m_aPageStart[nPage-1];

// magic
    // Set the page map mode units, and setup margin
    pDC->SetMapMode(MM_ANISOTROPIC);
    pDC->SetWindowExt(100, 100);
    pDC->SetViewportExt(pDC->GetDeviceCaps(LOGPIXELSX), pDC->GetDeviceCaps(LOGPIXELSY));

    pInfo->m_rectDraw.SetRect(0, 0, pDC->GetDeviceCaps(HORZRES), pDC->GetDeviceCaps(VERTRES));
    pDC->DPtoLP(&pInfo->m_rectDraw);

    if (m_pPrintOptions)
    {
        CRect rcMargins = m_pPrintOptions->GetMarginsLP(pDC);
        pInfo->m_rectDraw.DeflateRect(rcMargins);
    }

// end magic

    // print as much as possible in the current page.

    nIndex = PrintPage(pDC, pInfo, pInfo->m_rectDraw, nIndex);

    // update pagination information for page just printed
    if (nPage == (UINT)m_aPageStart.GetSize())
    {
        m_aPageStart.Add(nIndex);
    }
    else
    {
        ASSERT(nPage < (UINT)m_aPageStart.GetSize());
        m_aPageStart[nPage] = nIndex;
    }
}


Posted By: zaksoft
Date Posted: 26 March 2009 at 2:06am
I've found the attached sample helpfully! Thancs, It's what I was searching for.. 2 questions..
 
1) on OnFileCaptionbarlayout() m_wndCalendarCaptionBar.UseOneLine(!m_wndCalendarCaptionBar.IsUseOneLine()) in undefined... Do I miss something ?

2) Algae reports a fix for printing withinh CReportForDialog, again I've missed something ?

 
And since maybe my lucky day... We work with spa center and normally they work with weeks r weekend... Is there any way to show 2 or 3 days (and mainly print them together) without setting all 7 days ?.
 
Normally people arrive at friday evening and get reservations for late friday, saturday and sunday and take a list of tratment. The problem using full week presentation is that columns are narrow (an half empty) so not all information are printed.
 
Thank you.


-------------
VS2008 SP1 - VS2010 SP1 - VS2012 - MFC MBCS Statically linked
XTP 15.3.1 Static Link
---------------------------------------------------------
Davide Zaccanti - ZakSoft - www.zaksoft.com


Posted By: mdoubson
Date Posted: 26 March 2009 at 9:46am
1) No you don't miss - if you found some features from 13.1 - just comment it. Will be soom. You can see this features working in the set of static apps

https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar - https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar
https://forum.codejock.com/uploads/DemoVersion/CalendarOnDialogWithCaptionBarStatic.rar - https://forum.codejock.com/uploads/DemoVersion/CalendarOnDialogWithCaptionBarStatic.rar
https://forum.codejock.com/uploads/DemoVersion/OutlookLikeStatic.rar - https://forum.codejock.com/uploads/DemoVersion/OutlookLikeStatic.rar
https://forum.codejock.com/uploads/DemoVersion/ReportSampleSatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportSampleSatic.rar
https://forum.codejock.com/uploads/DemoVersion/NewStyleAppSource.rar - https://forum.codejock.com/uploads/DemoVersion/NewStyleAppSource.rar
https://forum.codejock.com/uploads/DemoVersion/FeaturePackCalDemoStatic.rar - https://forum.codejock.com/uploads/DemoVersion/FeaturePackCalDemoStatic.rar
https://forum.codejock.com/uploads/DemoVersion/MDITextEditorStatic.rar - https://forum.codejock.com/uploads/DemoVersion/MDITextEditorStatic.rar
https://forum.codejock.com/uploads/DemoVersion/TestVirtualListIcon.rar - https://forum.codejock.com/uploads/DemoVersion/TestVirtualListIcon.rar
https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStatic.rar - https://forum.codejock.com/uploads/DemoVersion/EditVirtualListIconStatic.rar
 
2) You can try his solution but this is not too generic
 
3) You can set your working days as Friday-Sun and have 3 days working week. Use Options control to set on-fly or code to do the same settings change
You can set Week Start day as Fri also


-------------
Mark Doubson, Ph.D.


Posted By: zaksoft
Date Posted: 28 March 2009 at 2:54pm
Thank you, I'll try to set working days as you suggest.
 
2 more questions:
 
1) I've read about next version due in mid-summer, you wrote about 13.1 soon.. 2 different releases ? ( this because in the calendarondialog sample in rar the timeline check box is correct, building with 13.0 is a radio button)
 
2) It is possible to insert in the wish list for planner in week mode to skip all days without any appointment ? this will solve many problems related to narrow columns.
 
Thank you again for your support.
 
 


-------------
VS2008 SP1 - VS2010 SP1 - VS2012 - MFC MBCS Statically linked
XTP 15.3.1 Static Link
---------------------------------------------------------
Davide Zaccanti - ZakSoft - www.zaksoft.com


Posted By: mdoubson
Date Posted: 28 March 2009 at 4:03pm
Hi, 13.1 is official version which suppose to go in May-June. I am ready to demonstrate now many coming features and fixes in beta-version or static app build with new code as I am interested in feedback from all or you.
 
I think what it will be possible to introduce compact multi-column week mode which can have dynamic column width (with 0 if no events) but it will means what calendars for different weeks can have different number of visual columns. It also means that we should introduce view-only mode as if you will hide some columns because no events - you can't add new events or modify existed events in such mode. Too restricted? What's about current scheme with resizable grid columns? We can have some predifne minimum width so user will not loose some day of week but screen space can be use better then now.
 
Of cource all existed mode will be as now and set as defaults.
 
By the way - I found and fix some typo bug (used OR instead of AND in some condition) which prevent action on left datepicker button click if current month is February. Current updates in static demo apps had this fix:
 
https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar - https://forum.codejock.com/uploads/DemoVersion/CalendarDemoStatic.rar
https://forum.codejock.com/uploads/DemoVersion/OutlookLikeStatic.rar - https://forum.codejock.com/uploads/DemoVersion/OutlookLikeStatic.rar
https://forum.codejock.com/uploads/DemoVersion/FeaturePackCalDemoStatic.rar - https://forum.codejock.com/uploads/DemoVersion/FeaturePackCalDemoStatic.rar


-------------
Mark Doubson, Ph.D.


Posted By: securigy
Date Posted: 31 March 2009 at 6:36pm
so how do you print the Report Control that is embedded in the dialog? Where can I get the sample code?


Posted By: mdoubson
Date Posted: 06 April 2009 at 10:25am
There are many samples in CodeProject about printing without Doc-View acrchitecture - e.g. in Dialog. Look please. There is CJ sample with Calendar embedded in dialog print - https://forum.codejock.com/uploads/temp/20090325_224348_CalendarOnDialo.rar - https://forum.codejock.com/uploads/temp/20090325_224348_CalendarOnDialo.rar

-------------
Mark Doubson, Ph.D.


Posted By: Algae
Date Posted: 06 April 2009 at 2:42pm
Securigy - if you'd like, I can post the ReportControl class I developed. It includes most of the features of ReportView printing. Not as universal as the print helper class that is in this thread.




Posted By: securigy
Date Posted: 06 April 2009 at 4:02pm
I'd appreciate that. I am at the stage where I cannot redo my ReportControl into the one that is derived from ReportView without major surgery...


Posted By: Algae
Date Posted: 06 April 2009 at 9:37pm
Ok, this should help you out:

uploads/20090406_213647_ReportForDialog.zip - uploads/20090406_213647_ReportForDialog.zip


Posted By: mdoubson
Date Posted: 06 April 2009 at 10:42pm
Wrong link - this is proper one: https://forum.codejock.com/uploads/20090406_213647_ReportForDialog.zip - https://forum.codejock.com/uploads/20090406_213647_ReportForDialog.zip
 
This is ONLY printing (no print preview) support - functions from XTPReportView copied into derived ReportControl.
 
Approach with helper I described before also have no print preview and easy to use - add 2 files and couple lines in your own code to call print when needed


-------------
Mark Doubson, Ph.D.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net