Print Page | Close Window

add header/footer to ReportControlview print ?

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=14913
Printed Date: 27 September 2024 at 9:05am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: add header/footer to ReportControlview print ?
Posted By: unknow
Subject: add header/footer to ReportControlview print ?
Date Posted: 05 August 2009 at 5:33pm
Hi. The Reportcontrolview demonstrated with the Reportsample demo app provides Printing and PrintPreview capabilities.
 
I would like to be able to add a text header and footer to this view to include current page, total page etc...
 
How can I do that ?
 
Thankx!!



Replies:
Posted By: mdoubson
Date Posted: 06 August 2009 at 7:15pm
This is supported feature - check class CXTPReportViewPrintOptions (file XTPReportView.h)

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


Posted By: unknow
Date Posted: 10 August 2009 at 6:36pm

Thanks; I understand it works with formatstring features;

What are the "variables" to pass to the formatstring member to insert current page, total pages, date/time etc...
 
For example, let's say I want to display a static text as header and a variable text as footer like the date on the left and the #/pages on the right.
 
Can someone link me to a sample or provide the code portion?
 
Is it also possible to add graphical elements like lines or a rectangle around the header/footer?
 
Thankx!


Posted By: mdoubson
Date Posted: 10 August 2009 at 6:43pm
This vars used in CXTPReportPageSetupDialog class so look in this class source e.g.

CReportPaneViewView use this

m_pPrintOptions->GetPageHeader()->m_strFormatString = "Header text: &p from &P";
 
https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar
https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.rar - https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.rar
'Header text: ' and ' from '- static parts, &p and &P - dynamic parts

No support for graphical elements but you can use Watermark image in print / printpreview using special flag:

GetReportCtrl().SetWatermarkBitmap(_T("C:\\MyJpgFile.jpg"), 100);

GetReportCtrl().SetWatermarkAlignment(xtpReportWatermarkCenter | xtpReportWatermarkVCenter | xtpReportWatermarkPreserveRatio | xtpReportWatermarkStretch);

GetReportCtrl().GetPaintManager()->m_bPrintWatermark = TRUE;

see http://forum.codejock.com/forum_posts.asp?TID=14922 - http://forum.codejock.com/forum_posts.asp?TID=14922   with snapshots


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


Posted By: unknow
Date Posted: 11 August 2009 at 3:10pm
Wow, looks awesome, I'm going to look at these !
 
Where can I see all the variables available to use, CXTPReportPageSetupDialog ?


Posted By: mdoubson
Date Posted: 11 August 2009 at 3:22pm

XTPReportView.h, XTPDrawHelpers.h



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


Posted By: unknow
Date Posted: 14 August 2009 at 4:54pm

I have one more concern when I look at this great sample:

 I see that the WHOLE printing code (including pagesetup options, paginate, header/footer customization...) has been re-done, compared to the "ReportSample" which uses the default built-in code.
 
This "ReportPaneView" even replaces the printing preview toolbar with a new one
 
So I understand I shouldn't use the default code and get all from the ReportPaneView sample ? or is this code is about to be implemented as default for next codejock release ?
 
Thankx!


Posted By: mdoubson
Date Posted: 14 August 2009 at 5:05pm
You rigth in term of totally updated CXTPReportView class but it is not related to printpreview framework -
 
I just use COMMANDBARS PrintPreview framework which do nothing with real printpreview code except toolbar, buttons, zooming -
 
DoPrintPreview internally call my function CXTPReportView::OnFilePrintPreview() which do real work.
 
If I compile withiout COMMANDBARS and use CXTPReportView::OnFilePrintPreview()) only - everything will be the same -
only use old microsoft printpreview toolbar with only 2 pager button (Next and Prev)
 
void CReportPaneViewView::OnFilePrintPreview() {

#ifdef _XTP_INCLUDE_COMMANDBARS

CPrintPreviewState* pState = new CPrintPreviewState;

if ( !DoPrintPreview( XTP_IDD_PREVIEW_DIALOGBAR, this,

RUNTIME_CLASS( CXTPPreviewView ), pState )) { delete pState; }

#else

CXTPReportView::OnFilePrintPreview();

#endif

}

This is source code - https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.rar - https://forum.codejock.com/uploads/DemoVersion/PaneViewReportSource.rar  - build yourself both variants and compare

 



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


Posted By: mdoubson
Date Posted: 14 August 2009 at 8:21pm
I modify sample - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar - https://forum.codejock.com/uploads/DemoVersion/ReportPaneViewStatic.rar
you can use toolbar printpreview button (before help) to launch std framework printpreview and menu - file - printpreview to launch CJ framework printpreview


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


Posted By: zaksoft
Date Posted: 15 August 2009 at 2:13am
One problem alreade seen in other cases.
 
1) Open exe
2) Click Help-> Release Sort
3) Click Close
 
On middle of header title "Column 8" there is a vertical 2..3 pixel red line.
 
 
Tested both on Vista 32 SP2 and XP 32 SP3 at different resolution
 


-------------
VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com



Posted By: mdoubson
Date Posted: 15 August 2009 at 2:22am
This is normal reaction - not a problem - because you use Wysiwyg mode - this red marker (end of visual page) help you properly resize columns to fit in page
 
You can use some handler (button, menu...) with code:

GetReportCtrl().GetPaintManager()->SetColumnWidthWYSIWYG(!GetReportCtrl().GetPaintManager()->IsColumnWidthWYSIWYG());

GetReportCtrl().RedrawControl();

and this red marker disapear. Later you can call same handler again to switch back to WYSIWYG mode
 


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


Posted By: unknow
Date Posted: 17 August 2009 at 5:42pm
Thanks Mark for the explanation of the reportpaneview sample, I could include the improved look without efforts
 
Another question if you don't mind;
 
Using both standard printing implementation + standard page setup dialog implementation, how can I get access to the header + footer customization so I can save/load them with the opened document ?
 
Extra question: Is there also a way to "intercept" the header/footer at printing time in order to manage additional custom variables ?
 
Thanks a lot!


Posted By: mdoubson
Date Posted: 17 August 2009 at 5:53pm
Additional custom variables - only if you derive own ReportView class.
 
Basic custom variables - sure: you have this two strings (in CXTPReportView or your derive class like CReportPaneViewViewto store and load
 
GetPrintOptions()->GetPageHeader()->m_strFormatString

GetPrintOptions()->GetPageFooter()->m_strFormatString

You can keep in this vars enough information (and using "\n" add extra lines)


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


Posted By: mdoubson
Date Posted: 02 September 2009 at 10:10pm
Follow my promice - I add CXTPReportPaintManager::ShowWYSIWYGMarkers(BOOL bSet) function  -
you can dynamically set it On or Off to show or hide Red End of Page WYSIWYG mode markers


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


Posted By: zaksoft
Date Posted: 03 September 2009 at 5:02am
Thank you


-------------
VS2022 - MFC MBCS Statically linked

XTP 23.1 Static Link

---------------------------------------------------------

Davide Zaccanti - ZakSoft - www.zaksoft.com




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