Print Page | Close Window

Saving columns

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=6756
Printed Date: 22 November 2024 at 1:39pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Saving columns
Posted By: Staffan V
Subject: Saving columns
Date Posted: 29 March 2007 at 7:28am
I have set up a CXTPReportControl and populated the columns (hiding some) and setting their widths, titles and so on. The user may then move around the columns, show some, hide some and change their widths. Is there a way to save the altered settings so I can restor them the next time the user opens the control?



Replies:
Posted By: Staffan V
Date Posted: 29 March 2007 at 7:35am
At first I used
    CXTPReportColumns *pReportColumns = m_ReportCtrl.GetColumns();
    for( int f = 0; f < NR_OF_COLUMNS; f++ )
    {
        CXTPReportColumn *pReportColumn = pReportColumns->GetAt(f);
        pReportColumn->SetVisible(false or true);
        pReportColumn->SetWidth( the width );
    }

then I saved them in a simmilar way. The problem is that the user may move around the colums so the old column 3 is now column 5 so that way doesn't work at all.


Posted By: Staffan V
Date Posted: 27 September 2007 at 8:03am
Isn't there a way to save what columns are shown and their width?
Ok, what about how to get the data and save it myself?

Hello? Anybody?


Posted By: Staffan V
Date Posted: 27 September 2007 at 11:07am
Ah, I managed to figure it out by myself. It was a bit easier than I thought.

All I did was
    CXTPPropExchangeXMLNode px(FALSE, 0, _T("IndexSearch"));
    m_ReportCtrl.DoPropExchange(&px);
    px.SaveToFile(sFilename);

to save and

    CXTPPropExchangeXMLNode px(TRUE, 0, _T("IndexSearch"));
    if( px.LoadFromFile(sFilename) )
        m_ReportCtrl.DoPropExchange(&px);

to load.





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