Question

I have an application which generates report and till date I am generating the Print/Print Preview through the MFC based formatting and Layout stuff.

As a Face Lift I now try to Export the report as a well formatted HTML File and now try to show the same. But I cant find control or mechanism to do that in MFC.

Please help me in Printing and Showing the Print Preview of the HTML File using the MFC's Doc/View Architecture.

Thanks a Lot in advance :)

Was it helpful?

Solution

After a lots of research and trials found a way to implement this.

Used a new View called CMyHtmlView which was inherited from the CHtmlView for my old Document.

class CReportWebView : public CHtmlView
{
protected: // create from serialization only
    CReportWebView();
    int     m_reportID;
    DECLARE_DYNCREATE(CReportWebView)

public:

    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CReportWebView)
    protected:
    virtual void OnInitialUpdate(); // called first time after construct
    virtual void OnFilePrintPreview();
    virtual void OnFilePrint();
    virtual void OnNavigateComplete2(LPCTSTR strURL);
    //}}AFX_VIRTUAL

// Implementation
public:
    virtual ~CReportWebView();

    //{{AFX_MSG(CReportWebView)
        // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
};

More details can be found in my other question

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top