Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Columns in ReportGrid Collapse All
Subject Author Date
Anil Siddhpura Feb 23, 2009 - 4:54 AM

Hi,

I used CExtReportGrid class to generate the reports. I have several columns in report. Now, if I remove some columns then when I generate report again then those removed column should not be there. But, currently it is not happening. I saw prof-uis sample project of reportgrid. In which it is like that(If i remove columns then again when I start reportgrid project the removed columns were not there.) So how to do this?

Technical Support Feb 24, 2009 - 1:13 PM

Yes, you can use the system registry for saving the state of the report grid control before print/preview generation and loading after. The CExtReportGridWnd::ReportGridStateSave() and CExtReportGridWnd::ReportGridStateLoad() methods does this work. Alternatively you can use the CExtReportGridWnd::ReportGridStateSerialize() method and the CArchive streams created over the CMemFile object.

Anil Siddhpura Feb 25, 2009 - 10:27 PM

Hi,


What is the difference between two methods? & which one is better?


 


 


 

Technical Support Feb 26, 2009 - 1:23 PM

The CExtReportGridWnd::ReportGridStateSave() and CExtReportGridWnd::ReportGridStateLoad() methods are designed for saving/loading state of the report grid control to/from the specified location in the system registry.
The CExtReportGridWnd::ReportGridStateSerialize() method saves/loads state of the report grid control to/from the CArchive stream.
The first two methods are based on third because they are creating CArchive and CMemFile objects and then invoke the CExtReportGridWnd::ReportGridStateSerialize() method.
You can use any variant you like.

Technical Support Feb 23, 2009 - 7:25 AM

The printing/previewing subsystem of the CExtReportGridWnd class uses only active report columns. So, you should activate required set of columns before entering printing/previewing. You should implement the CExtPPVW_Printable::OnPreparePrinting() virtual method in your CExtPPVW < CExtReportGridWnd >-derived class:

BOOL CYourReportGridWndClass:: OnPreparePrinting( CPrintInfo * pInfo )
{
//
// activate/deactivate required columns here
// (use the CExtReportGridWnd::ReportColumnIsActive() and CExtReportGridWnd::ReportColumnActivate() methods)
//
BOOL bRetVal = CExtPPVW < CExtReportGridWnd > :: OnPreparePrinting( pInfo );
//
// restore previously active columns here
//
return bRetVal;
}

Anil Siddhpura Feb 24, 2009 - 6:31 AM

HI,

But i saw Prof-Uis sample code for reports. In which you have not used CExtPPVW_Printable::OnPreparePrinting().

What I want is, I have several columns in my report. Some of them are initially active & some are Inactive. Now, once I generate report & then remove some columns or add any columns from column Chooser then close the report & then again when I generate the report it should be like the last state of report.(Means removed columns should not be there & added columns should be there). Are you storing this info in registry?