We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Copying RTF from RichEditBox to SfRichTextBoxAdv

I'm getting this exception while loading the stream into SfRichTextBoxAdv

{"'Windows-1252' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.\r\nParameter name: name"}

Code:

                var iStream = new InMemoryRandomAccessStream();
                this.ContentTextBox.Document.SaveToStream(Windows.UI.Text.TextGetOptions.FormatRtf, iStream);
                iStream.Seek(0);
                this.RichTextBoxAdv.Load(iStream.AsStream(), Syncfusion.UI.Xaml.RichTextBoxAdv.FormatType.Docx);

Any idea how I can fix this?

4 Replies

NT Nima Tayebi August 26, 2015 08:00 AM UTC

It took me a while but I found the solution.
Windows-1252 is downloadable with a NuGet package: System.Text.Encoding.CodePages

Then I needed to add this line to my code

                Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);


NS Narendran Srinivasan Syncfusion Team August 26, 2015 11:44 AM UTC

Hi Nima

Thanks for choosing Syncfusion products,


The mentioned exception is raised due to not installing the ‘System.Text.Encoding.CodePages’ so when we accessing the GetEncoding method this exception raised. Once the nugget ‘System.Text.Encoding.CodePages’ has installed this exception has been resolved. But in our machine we could not able to reproduce the mentioned exception while loading RichEditBox document stream in our SfRichTextBoxAdv control. In our side the given code snippet is working fine in our supported platforms. We request you to provide the details about Visual Studio, Operating system versions and in which platform and framework you are getting this issue. If possible please provide us a sample so that we can validate more on this and provide you with appropriate solution at the earliest.

Please let us know if you have any other questions.

Regards,
Narendran




NT Nima Tayebi August 26, 2015 05:22 PM UTC

Hi Narendran, 
I'm using WinRT libraries on Windows 10 UWP that is not officially supported by your the libraries. 
Please let me know if you need more information.
Thanks, 
Nima


AP Arumuga Perumal S Syncfusion Team August 27, 2015 09:04 AM UTC

Hi Nima,

Thank you for your update.

We have already provided support for SfRichTextBoxAdv control in Universal Windows platform and is included with our Essential Studio for UWP. You can download it from the following link.

http://www.syncfusion.com/downloads/uwp

You can use our UWP assemblies for building Universal Windows applications.

Please let us know if you have any other questions.

Regards,
Arumuga Perumal S.


Loader.
Up arrow icon