Printing Report Control embedded in a Dialog |
Post Reply |
Author | |
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
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. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Consider attached sample with Calendar inside dialog - it allow to print using 2 helper files - DialgoPrintHelper.cpp and .h
Code OnFilePrint - inside CalendarOnDialogDlg.cpp
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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; } } |
|
zaksoft
Senior Member Joined: 05 June 2003 Location: Italy Status: Offline Points: 162 |
Post Options
Thanks(0)
|
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. |
|
VS2022 - MFC MBCS Statically linked
XTP 23.1 Static Link --------------------------------------------------------- Davide Zaccanti - ZakSoft - www.zaksoft.com |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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/CalendarOnDialogWithCaptionBarStatic.rar https://forum.codejock.com/uploads/DemoVersion/OutlookLikeStatic.rar https://forum.codejock.com/uploads/DemoVersion/ReportSampleSatic.rar https://forum.codejock.com/uploads/DemoVersion/NewStyleAppSource.rar https://forum.codejock.com/uploads/DemoVersion/FeaturePackCalDemoStatic.rar https://forum.codejock.com/uploads/DemoVersion/MDITextEditorStatic.rar https://forum.codejock.com/uploads/DemoVersion/TestVirtualListIcon.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
|
|
zaksoft
Senior Member Joined: 05 June 2003 Location: Italy Status: Offline Points: 162 |
Post Options
Thanks(0)
|
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.
|
|
VS2022 - MFC MBCS Statically linked
XTP 23.1 Static Link --------------------------------------------------------- Davide Zaccanti - ZakSoft - www.zaksoft.com |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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:
|
|
securigy
Groupie Joined: 23 November 2007 Status: Offline Points: 41 |
Post Options
Thanks(0)
|
so how do you print the Report Control that is embedded in the dialog? Where can I get the sample code?
|
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
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.
|
|
securigy
Groupie Joined: 23 November 2007 Status: Offline Points: 41 |
Post Options
Thanks(0)
|
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...
|
|
Algae
Senior Member Joined: 08 January 2007 Location: United States Status: Offline Points: 217 |
Post Options
Thanks(0)
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Wrong link - this is proper one: 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
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |