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

Saving RichTextBox Contents

1 Answer 67 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Mel
Top achievements
Rank 1
Mel asked on 20 Jan 2012, 09:15 PM
Greetings,
I am having a problem now trying to save the contents from a RichTextBox.
In version 2011_3_116 I was able to successfully use the following code to pull the data stream from the richReport and save it to my database. It was then easy to load it back in. Now it seems the stream stops very early on and the transfer fails. Here is the code snippets that handle streaming it to my DB server:

SaveRichReport_ReportName(theReportName, richReport.GetXamlFromDocument());
...
            if (theReport != null && theReport.CanRead)
            {
                UploadEntry upload = new UploadEntry(reportName + ".xaml", theReport);
                uploadsInFlight.Add(upload);
                Utils.UploadFile(upload);
            }
...
        public static void UploadFile(UploadEntry upload)
        {
            if (UploadStarted != null)
            {
                UploadStarted(upload);
            }
        }
...
		private void StartUpload(UploadEntry upload)
		{
			//compute file digest
			string file_digest = UploadManager.ComputeHash(upload.GetStream(), sha1);
 
			//create file bucket
			RESTSubmit createFile = new RESTSubmit(upload);
			createFile.RequestComplete += new RESTSubmit.RequestCompleteDelegate(createFile_RequestComplete);
			createFile.RequestError += new RESTSubmit.RequestErrorDelegate(createFile_RequestError);
			Stream tStr = upload.GetStream();
			Dictionary<stringobject> parameters = new Dictionary<stringobject> { { "filename", upload.FileName }, { "file_digest", file_digest }, { "patient_id", upload.patient_id }, { "file_length", upload.Length.ToString() }, {"can_resume""1"} };
			createFile.Submit(Utils.BaseUri + @"file/create", parameters, RESTSubmit.Method.POST);
		}


It is a circuitous route that it takes, but the process works uploading files from other parts of the application, but now it hangs when trying to save the xaml.
Thanks for your help,
Mel

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 25 Jan 2012, 04:22 PM
Hi Mel,

 We are successfully uploading a XAML from RadRichTextBox's Document using the Q3 2011, Q3 2011 SP and the latest internal builds. Could you please check out our test project and let us know if  we have missed something? Which is the RadControls' version that you use and which was your previous one ?   

Kind regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RichTextBox
Asked by
Mel
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or