Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Report Control
  New Posts New Posts RSS Feed - add header/footer to ReportControlview print ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

add header/footer to ReportControlview print ?

 Post Reply Post Reply
Author
Message
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post Topic: add header/footer to ReportControlview print ?
    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!!
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 06 August 2009 at 7:15pm
This is supported feature - check class CXTPReportViewPrintOptions (file XTPReportView.h)
Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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";
 

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;

Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post 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 ?
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2009 at 3:22pm

XTPReportView.h, XTPDrawHelpers.h

Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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 - build yourself both variants and compare

 

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 14 August 2009 at 8:21pm
I modify sample - 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
Back to Top
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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
 
Back to Top
unknow View Drop Down
Groupie
Groupie
Avatar

Joined: 14 January 2009
Location: Belgium
Status: Offline
Points: 62
Post Options Post Options   Thanks (0) Thanks(0)   Quote unknow Quote  Post ReplyReply Direct Link To This Post 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!
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
zaksoft View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 June 2003
Location: Italy
Status: Offline
Points: 162
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaksoft Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.203 seconds.