This is a migrated thread and some comments may be shown as answers.

"The given key was not present in the dictionary" - RadRichTextbox

1 Answer 110 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Purushothaman
Top achievements
Rank 2
Purushothaman asked on 10 Dec 2012, 10:59 AM
Hi Telerik Team,

In my Application am using RadRichTextbox Control to show the Title from RTF String.Some time its working fine.some time its giving exception (The given key was not present in the dictionary)

If Am using RTF String Like below means,

{\rtf1\ansi\ansicpg1252\uc1\deff0{\fonttbl  {\f0\fnil\fcharset0\fprq2 Arial;}  {\f1\fswiss\fcharset0\fprq2 Arial;}  {\f2\froman\fcharset2\fprq2 Symbol;}}  {\colortbl;\red0\green0\blue0;\red255\green255\blue255;}  {\stylesheet{\s0\itap0\nowidctlpar\f0\fs24 [Normal];}{\*\cs10\additive Default Paragraph Font;}}  {\*\generator TX_RTF32 15.0.530.502;}  \deftab1134\paperw12240\paperh15840\margl1440\margt1440\margr1440\margb1440\widowctrl\formshade\sectd  \headery720\footery720\pgwsxn12240\pghsxn15840\marglsxn1440\margtsxn1440\margrsxn1440\margbsxn1440\pard\itap0\nowidctlpar\plain\f1\fs24 Testing Data \par }
its giving Error like as Output.Jpg (Fig - 1)

if am using RTF string Like as below means

{\rtf1\ansi\ansicpg1252\uc1\deff0{\fonttbl{\f0\fnil\fcharset0\fprq2 Arial;}{\f1\fswiss\fcharset0\fprq2 Arial;}{\f2\froman\fcharset2\fprq2 Symbol;}}{\colortbl;\red0\green0\blue0;\red255\green255\blue255;}{\stylesheet{\s0\itap0\nowidctlpar\f0\fs24 [Normal];}{\*\cs10\additive Default Paragraph Font;}}{\*\generator TX_RTF32 15.0.530.502;}\deftab1134\paperw12240\paperh15840\margl1440\margt1440\margr1440\margb1440\widowctrl\formshade\sectd\headery720\footery720\pgwsxn12240\pghsxn15840\marglsxn1440\margtsxn1440\margrsxn1440\margbsxn1440\pard\itap0\nowidctlpar\plain\f1\fs24 Testeing Record for RadRichTextbox Control\par }
its working fine  like as Output.Jpg (Fig - 2).

Please tell me why its happen in First RTF String and please let me know how to handle this issues.



1 Answer, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 13 Dec 2012, 12:46 PM
Hi,

We examined the problematic document and found that there are some spaces in the first document, that are causing problems while parsing. For example there is a pair of spaces just after the \fonttbl tag which are preventing our parser to read the font table of the document correctly and this results in the exception you get. If these spaces are removed the document is opened normally. 
We also noticed that the same pattern - a pair of spaces after some of the RTF tags is repeated throughout the first document sample. The second document however does not have any of those. 
Can you please share more information about the application that generated these RTF documents or weather there are some settings you can use to control the RTF that is generated.
I hope that was helpful.

Kind regards,
Alex
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RichTextBox
Asked by
Purushothaman
Top achievements
Rank 2
Answers by
Alex
Telerik team
Share this question
or