Help Center

CRichEditCtx.InsertDocFilemethod

Inserts the contents of the specified RTF file.

Windowsmethoddocumented

Syntax

FUNCTION InsertDocFile (BYREF wszFileName AS WSTRING, BYVAL dwPos AS DWORD, BYVAL CodePage AS DWORD = CP_ACP) AS DWORD

Parameters

NameDescription
wszFileNamePath and name of the RTF file to insert.
dwPosLocation where to insert the RTF file. If dwPos = -1, the contents of the RTF file are inserted at the caret position.
CodePageThe code page to use for the conversion. Besides the default (CP_ACP), you can use CP_ANSI (ansi), CP_UTF8 (utf8) or 1200 (unicode).

Description

Inserts the contents of the specified file at the specified location. Besides .rtf files, this method also insert the content of ansi, unicode or utf8 files if you specify the appropriate code page.

Examples

IM wszFileName AS WSTRING * MAX_PATH = AfxGetExePath & $"\Test.rtf" RichEdit->InsertDocFile(wszFileName, 500) -- or -- RichEdit->InsertDocFile(wszFileName, -1)

IM wszFileName AS WSTRING * MAX_PATH = AfxGetExePath & $"\Test.txt" RichEdit->InsertDocFile(wszFileName, 500, CP_ANSI) -- or -- RichEdit->InsertDocFile(wszFileName, -1, CP_ANSI)

IM wszFileName AS WSTRING * MAX_PATH = AfxGetExePath & $"\Test.txt" RichEdit->InsertDocFile(wszFileName, 500, CP_UTF8) -- or -- RichEdit->InsertDocFile(wszFileName, -1, CP_UTF8)

IM wszFileName AS WSTRING * MAX_PATH = AfxGetExePath & $"\Test.txt" RichEdit->InsertDocFile(wszFileName, 500, 1200) -- or -- RichEdit->InsertDocFile(wszFileName, -1, 1200)

Insert a RTF file. Insert a file with ansi contents. Insert a file with utf8 contents. Insert a file with unicode contents.

Reference

  • Defined in AfxNova/CRichEditCtx.inc:3584
  • Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
  • Topic: CRichEditCtx Class