简体   繁体   中英

HTML Print and Print Preview in VC6 and MFC

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 :)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM