質問

I've created a Rich Edit control (1.0) from MFC as below

m_hRichEditWnd = ::CreateWindow(_T("RichEdit"), csWindowName, ES_MULTILINE|ES_READONLY, 0, 0, 200, 200, NULL, 0, 0, 0);

I've read text into that control from a file. The file is a multipage .txt document with ascii control characters for page breaks. When I print from the Rich Edit control, I do not get the page breaks. They are printed out as characters. Is there any way to get those page breaks?

I'm printing out from the control using methods similar to those described here http://msdn.microsoft.com/en-us/library/windows/desktop/bb787875(v=vs.85).aspx

Thanks!

役に立ちましたか?

解決

So something I left out was that I wasn't actually printing out to a physical printer but to a .ps file. That .ps file was then getting converted by ghost script to a pdf which did not register the page breaks. I believe this is due to the fact that the edit control does not actually SHOW page breaks inside it - and the way the print command works is almost like a graphic blit to a print device. The page break isn't "on screen" so it doesn't make it to the .ps file. That's a theory.

The only solution I found was to parse the information going into the CRichEditControl for form feed characters. Load up all characters up to the form feed character, print that to the file, then use the EndPage() function to manually force the form feed. Continue on in that way until there are not more form feed characters. Then make sure you print out any remaining characters after the last form feed.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top