Click here to Skip to main content
16,018,534 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Guys,

My RichTextBox control in Winforms does not display images of certain RTF documents. Can someone maybe point me in the right direction. The following example displays perfectly in both Word 2016 and in WordPad, but not in the RTB. The text always displays perfectly.


{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang7177\deflangfe7177{\fonttbl{\f0\fnil\fcharset0 Calibri;}{\f1\fswiss\fprq2\fcharset0 Calibri;}}
{\*\generator Riched20 10.0.14393}{\*\mmathPr\mdispDef1\mwrapIndent1440 }\viewkind4\uc1 
\pard\widctlpar\f0\fs22\lang9 Test\par

\pard\widctlpar\sl240\slmult1{\pict{\*\picprop}\wmetafile8\picw794\pich873\picwgoal450\pichgoal495 
0100090000033806000000000f06000000000400000003010800050000000b0200000000050000
000c0221001e00030000001e00040000000701040004000000070104000f060000410b2000cc00
21001e000000000021001e0000000000280000001e000000210000000100180000000000dc0b00
00000000000000000000000000000000009c9c949c9c9c9494949c9494948c8c9c94949c948c9c
9c9494948c949494949494949494948c8c9c949494948c94948c8c8c8c8c8c8c847b847b737b73
73737b73736b6b6b6b6b6b6363636b6b6b6b636b6b636b63636394948c0000a5a5949c9c949c9c
9c9c9c949c9c949c9494a59c9c9c9c949c9c9c9494949c9c949c9c94a59c949c9c94a59c949c9c
949c9c94948c8c8c8c8c847b848484847b73737b73736b6b6b6b6b6b6363636b6b6b63636b636b
6b8c8c8c00009c9c94a59c9c9c9c949c9c949c9c94a59c9c9c9c9ca59c9c9c94949c9c94a59c94
ada59cadada5b5bdbda5b5bda5bdbda5adb59cadb594949c8c9ca584848c7b7b7b736b6b736b6b
636b6b6b6b6b6363636b6b6b5a63638c8c8c0000ada594a59c9ca59c9c9c9494a59c9ca59c94a5
a59ca59c9ca5a59ca5a5a5adadadadbdbdb5ced6adcedeadcedeadc6d6b5c6d6a5b5c6adadc6a5
bdc69ca5bd7b9cad84848c7373736b73736b6b736b7373636b6b6b6b6b848c8c0000a59c94a59c
9c9c9c94a59c9c9c948ca59c949c9c9ca5a59ca59c9cadadadb5bdbdb5cedeb5cedeb5d6e7b5ce
deb5cedeadc6d6a5a5bdadb5c6adbdce9ca5bd9ca5b58ca5b5848494636b6b6b6b6b6b6b736b6b
73636b63848c8c0000ada59ca59c94a59c9c9c9c9ca59c949c9c94a5a5a5a59c9cadada5b5bdbd
bdd6debdd6e7bdd6e7b5d6e7bdd6e7bdced6b5c6d6a5a5b5a5a5ada5adb59ca5b5948ca59cadbd
8c94ad7b8c8c6b6b6b7373736b73736b6b6b7b84840000a59c9ca5a59c9c9c949c9c949c9c94a5
a59c9c9c94a5a59cb5b5adbdd6debdd6deb5d6e7b5cedeb5d6e7bdcedeadc6d6a5b5b5a59c9494
8c8c9c9c9c8c949c848c8c848484848c8c7b8c9473737373736b6b7373636b6b848c8c0000a5a5
9c9c9c94a59c949c9494a59c94a59c94a59c94adada5bdced6bdd6e7c6d6e7b5cedeadc6de94b5
ce9cb5cea5b5bd9c9c94948c7b8c8c8494949c9ca5ad7b848c7b847b737b73737b7b737373737b
7b6b73736b737b7b848c0000a59c9ca5a5949c948c9c9c8c9c948c9c9c8ca59c94b5bdbdb5cede
c6dee7c6d6e7c6d6e7bdd6e7bdcee794adbd9ca59c948c84948c848c8c849c949c949cad848c8c
7b84847b848473737b73737b6b73736b737b636b7373848c0000ada5a5a59c9ca5a59ca59c94a5
a5949c9c8cb5ada5bdced6c6deefc6deefcedeefc6d6e7c6d6e7c6d6e7b5c6d69c9494948c8c94
948c9c948c9494949ca5b5848c8c848c947b84847b848c737b84737b846b7b846b73846b7b8400
00a5a59ca5a59ca59c9ca5a594a59c94a5a594b5b5b5bdd6e7c6dee7cedeefc6dee7cedeefbdce
deb5cedeadb5b59c94948c8c8c9c9c9c9c94949494949ca5bd8c8c947b848c7b848c7b7b84737b
846b737b737b846b737b6b7b8c0000adada5a5a59ca5a5a5a5a59cada59cadada5bdcecec6dee7
cee7efcedeefc6deefc6deefc6d6e7c6d6e7b5bdc6a5a5a5949494a5a5a5ada5a59c9c9ca5b5c6
8c8c94848c947b848c848494737b847b848c6b73846b73846373840000a5a59ca5a59ca5a59ca5
a59ca5a594b5ada5b5ced6c6deefc6dee7c6deefc6deefcedeefbdcedec6d6e7bdced6adbdc694
948cada5a5b5b5b5b5b5bd9cb5c68c8c947b848c7b848c73737b737b84737b84737b84636b7b63
73840000adada5a5a59cada5a5a5a594adad9cb5b5adbdd6e7c6dee7c6d6e7bdcedecedee7c6d6
e7c6cee7bdcedeb5c6d6a5adad9c948ca5a5a5bdc6d6bdc6c6adbdd694949c8c949c848c947b84
8c737b8473848c6b73846b73846373840000a5a59ca5a59c9c9c94a5a594a59c94b5bdb5add6de
cedeefc6d6e7adbdd6b5cedeb5c6deb5c6d6b5c6cea5a59ca59c8c948c849c9c9cbdc6cebdced6
bdc6d6a5a5b59494a5848c947b849473848c6b73846b737b636b736373840000ada59ca59c94a5
a59c9c9c94ada59cb5bdb5b5d6e7c6deefcee7efbdcedec6deefbdd6e7bdcedeadadada59c9c9c
94949c9c9c9c9494adadb5bdc6d6bdcedeb5bdce9cb5c68c9cad8c9cad84949c7b8c946b73846b
737b636b7b00009c9c94a59c949c9c8c9c9c8ca59c84b5bdb5b5d6e7bddeefb5cedec6deefc6d6
e7c6d6e7b5c6cea5a5a59c94949c94949494949c9c94ada59cbdced6b5bdceb5c6d6a5b5c6848c
94737b84737b846b7b846b737b5a6b7363737b0000a59c949c9c94a59c949c9484a59c8cb5c6bd
bddee7bddeefb5d6e78c9cb5bdcedea5bdce94a5bd9c9c9c94949494948c94949494948cadadb5
bdc6d6a5b5bda5adb5b5bdce94a5ad7b84846b6b73737b84636b7363737b63737b00009c94949c
9c9494948c9c9484a59484bdbdbdc6d6dec6dee7b5dee7b5d6e79ca5bda5b5ceb5c6ce9c94948c
848494948c8c8c8c8c8c849c9c9cadbdd69cadbd8c94949ca5b594a5b5737b846b737b636b736b
737b636b736b7b840000a59c949c9c949c9c9494948ca59c8c7b52638c6b8ca59cadb5c6d6b5d6
e7bddeefc6d6e7bdc6ce949494949494948c849494948c8484948c8c9ca5b59cb5ce949ca5848c
8c7b848c737b846b737b6b737b636b736b737b6b7b7b00009c9c8c9c9c9c94949494948c9c9484
7b525a7331528c4a7b7b427384427394639494739494849494949c948c8c948c8c8c8c8c8c8c84
848484949ca59cadc6a5b5c6848c84737b7b6b73736b73736b737b6b737b636b736b7b7b0000a5
9c949c9c949c9c9494948c9c9c8c84636373315a8c427384427ba55a94a56ba5a573a59c6b9484
8c9494949494948c948c8c8c8c848c8c8c8c8c949cadbda5adb58c8c8c737b7b737b7b6b737373
7b7b6b737b6b737b6b7b7b00009c9c8c9c9c949c948c949484948c7b8c736b63294a7b315a7b39
639c528c844a7bb58cb59c6b947b7b8c8c8c8c94948c8c8c84948c8c8484848484849ca5a59ca5
a584848c7b8484737b7b737b7b6373736b7373636b73737b840000a59c949c948c9c9c8c94948c
9c9484948c7b6b314a63294a6b31527b39637b396b7b4a739c6b9c9473949494948c8c8c94948c
8c8c848c8c8c848c84949ca594a5a5848c8c737b7b737b846b737b7373736b73736b7b7b6b7b7b
00009c9c8c9c948c94948494948c948c7b9c947b734a5a63294a63294a84427384427b9c7badad
7bad7b4a6b8c7b848c8c8c8c8c848c8c7b848c848c948c8c949c949ca57b8484737b7b6b73736b
737b6b73736b73736b73736b737b00009c9c8c9c94849c9484948c7b9c948c948c7b9c84735a29
4a5a29427b396b945284739cbd8c5284844a738c637b8c8c848c8c848c8c848c948c8c8c849494
8c8c8c847b847b737b73737b7b6b73736b737b6b73736b73736b7373000094948c9c948c948c7b
948c7b948c8494947b948c738463636331527b426b6b315a9463946b315a946394946b947b6373
8c8c848c8c84848c8c848c8484847b84847b737b73737b736b737373737b6b6b736b73736b736b
6b736b00009c948c9494849494848c8c7b9494848c8c848c8c73948c737b6b735a63848c5a8463
31529c739c8c5284845a7b734a6384737b8c8c8c8c948c8c8c8494a5a58c9c9c7b84846b7b7373
7b7b6b7b7b737b7b6b7373737b736b736b00008c8c849494848c8c7b8c8c8484847b8c8c7b8484
7b8c8473848c737b63737b4a6b8c5a847b4a73946b946b395a946b945a314a8463737b6b6b949c
9494adb59cb5bd7b8484737b7b6b7b736b7b7b6b7b7b737b7b6b736b6b737300009494848c8c84
948c8c8c8c848c8c7b84847b8c8c848c847b8c8c738c8c7b8c737b7b526b94638c6b395a9c739c
6b395a946b9463395284637b7b73849cb5c69cb5bd848c8c737b73737b7b6b737b737b7b737b73
737b73737b7300008c8c848c8c848484848c8c848c847b8c8c8484847b8c847b84847b8c847b8c
847b8c847b7b5a737b52737b4a6b7b5273845a7b7342637b5a7b73637394adb594a5ad7b7b7373
73736b7b7b737b7b6b7373737b7b737373737b73000094948c8c8c848c8c848c8c84948c848c84
7b8c8c8484847b8c8c848c8c848c8c7b8484738c84738c73736b425a946b8c63394a84637b6b4a
637b6b6b848c7b7b847b7373736b736b737b736b7373737b7b737b73737b7b737b7300008c8c84
8c8c848c8c7b8c8c848c84848c8c848c847b8c8c848c84848c8c8484847b84847b847b6b847b6b
847b738c7b7b7363637b737373736b7b7b7373736373736b6b6b6b6b736b636b6b6b73736b7373
737b7b6b7373737b7b0000040000002701ffff030000000000
}\par

\pard\widctlpar\f1\par
}


What I have tried:

var rtf = File.ReadAllText("Test3.rtf");
			richTextBox1.Rtf = rtf; // Image does not display but text displays perfectly.

AND
			
richTextBox1.LoadFile("Test3.rtf"); // Image does not display but text displays perfectly.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900