Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to load and save MERGEFIELD ( \field ) entries in RichTextBox

$
0
0

Hello,

I load RTF-Content at runtime from database into a RichTextBox. This content can contain MERGEDFIELDs with the RTF \field tag. The RTF is loaded and saved with TextRange and DataFormats.Rtf  as shown in many other entries.

My Problem now is, that the \list entry is lost when I save the RichTextBox back to store.

Here is a sample:

loaded rtf:

{\rtf1\deff0{\fonttbl{\f0 Times New Roman;}{\f1 Arial;}}{\colortbl\red0\green0\blue0 ;\red0\green0\blue255 ;}{\*\listoverridetable}{\stylesheet {\ql Normal;}{\*\cs1 Default Paragraph Font;}{\*\cs2\sbasedon1 Line Number;}{\*\cs3\ul\cf1 Hyperlink;}{\*\ts4\tsrowd\ql\trautofit1\tscellpaddfl3\tscellpaddl108\tscellpaddfr3\tscellpaddr108\tsvertalt\cltxlrtb Normal Table;}{\*\ts5\tsrowd\sbasedon4\ql\trbrdrt\brdrs\brdrw10\trbrdrl\brdrs\brdrw10\trbrdrb\brdrs\brdrw10\trbrdrr\brdrs\brdrw10\trautofit1\tscellpaddfl3\tscellpaddl108\tscellpaddfr3\tscellpaddr108\tsvertalt\cltxlrtb Table Simple 1;}}\nouicompat\splytwnine\htmautsp\sectd\pard\plain\ql{\b\f1\fs20\cf0 Merkmale:}\b\f1\fs20\cf0\par\pard\plain\ql\par\pard\plain\ql{\field{\*\fldinst{\cf0 MERGEFIELD #1301}}{\fldrslt{\cf0 <<#1301>>}}}\par}

saved rtf:

{\rtf1\ansi\ansicpg1252\uc1\htmautsp\deff2{\fonttbl{\f0\fcharset0 Times New Roman;}{\f2\fcharset0 Arial;}}{\colortbl\red0\green0\blue0;\red255\green255\blue255;}\loch\hich\dbch\pard\plain\ltrpar\itap0{\lang1033\fs20\f2\cf0 \cf0\ql{\f2\b {\ltrch }\li0\ri0\sa0\sb0\fi300\ql\par}{\f2\b {\ltrch Merkmale:}\li0\ri0\sa0\sb0\fi0\ql\par}{\fs24\f0 \li0\ri0\sa0\sb0\fi0\ql\par}{\fs24\f0 {\ltrch <<#1301>>}\li0\ri0\sa0\sb0\fi0\ql\par}}}

Is there any way to get that correctly handled by the RichTextBox? I want to be able to make changes in the richtextbox without losing the MERGEDFIELD entry.

Thank you very much,

Tobias


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>