Ticket Q143621
Visible to All Users

XtraRichEdit LoadDocument from stream not working?

created 16 years ago

Attached is a small test project in which illustrates my issue.
I'm trying to use XtraRichEdit.LoadDocument to load from a memorystream, but I keep getting an "Invalid Rtf" error. After much time wasted thinking I wasn't creating the memorysteam correctly from my string data, I tried simply saving some text I typed into the editor to a memorystream, then loading it back in. I get the same "Invalid Rtf" error using the stream the control itself creates.
You can see this by running the project, typing some text in the editor, clicking the Save button, clearing the text in the editor, and clicking the Load button.
Am I doing something wrong here? There's not much documentation on this yet.
(FYI, the xtrarichedit is embedded in a usercontrol, but none of that affects this test code as far as I can tell. I'm working on creating a usercontrol that contains the editor and the ribbonbar that I can eventually embed in XAF. It works as far a appearances go, but I can't load and save data until I solve this problem.)

Comments (3)
DevExpress Support Team 16 years ago

    Hi David,
    Please add the tempStream.Seek(0, SeekOrigin.Begin) method call, as shown below :
        Private Sub LoadBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadBtn.Click
            MessageBox.Show("Memory stream loading. Length: " + tempStream.Length.ToString, "Load Starting")
            tempStream.Seek(0, SeekOrigin.Begin)
            Me.XtraRichEditUserControl1.RtfStream = tempStream
        End Sub
    It should fix your issue. Please try this solution and let us know the results.
    Thanks,
    Andrew

      Thanks. I thought something might be missing…

      DevExpress Support Team 16 years ago

        Hi David,
        I am glad to hear that the problem has been resolved. Thank you for letting us know of your progress.
        Please feel free to contact us in case of any difficulty. We will be happy to assist you.
        Thanks,
        Andrew

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.