Ejemplo n.º 1
0
        /// <summary>
        /// Converts an rtf content to xaml content.
        /// </summary>
        /// <param name="rtfContent">
        /// The source rtf content that to be converted into xaml content.
        /// </param>
        /// <returns>
        /// Well-formed xml representing XAML equivalent content for the input rtf content string.
        /// </returns>
        internal string ConvertRtfToXaml(string rtfContent)
        {
            // Check the parameter validation
            if (rtfContent == null)
            {
                throw new ArgumentNullException("rtfContent");
            }

            // xaml content to be converted from rtf
            string xamlContent = string.Empty;

            if (rtfContent != string.Empty)
            {
                // Create RtfToXamlReader instance for converting the content
                // from rtf to xaml and set ForceParagraph
                RtfToXamlReader rtfToXamlReader = new RtfToXamlReader(rtfContent);
                rtfToXamlReader.ForceParagraph = ForceParagraph;

                // Set WpfPayload package that contained the image for the specified Xaml
                if (WpfPayload != null)
                {
                    rtfToXamlReader.WpfPayload = WpfPayload;
                }

                //Process the converting from rtf to xaml
                rtfToXamlReader.Process();

                // Set Xaml content string that representing resulting Rtf-Xaml converting
                xamlContent = rtfToXamlReader.Output;
            }

            return(xamlContent);
        }
        // Token: 0x06003F37 RID: 16183 RVA: 0x00121088 File Offset: 0x0011F288
        internal string ConvertRtfToXaml(string rtfContent)
        {
            if (rtfContent == null)
            {
                throw new ArgumentNullException("rtfContent");
            }
            string result = string.Empty;

            if (rtfContent != string.Empty)
            {
                RtfToXamlReader rtfToXamlReader = new RtfToXamlReader(rtfContent);
                rtfToXamlReader.ForceParagraph = this.ForceParagraph;
                if (this.WpfPayload != null)
                {
                    rtfToXamlReader.WpfPayload = this.WpfPayload;
                }
                rtfToXamlReader.Process();
                result = rtfToXamlReader.Output;
            }
            return(result);
        }