Ticket T592120
Visible to All Users

Saving RichTextEdit to SQL Server and loading from SQL Server

created 7 years ago (modified 7 years ago)

Planning to use the RichTextEdit control for loading MS-Word documents and subsequent merging the documents with data. The MS-Word document will be initially loaded from the file system using the RichTextEdit.LoadDocument() method. The document needs to be subsequently saved to SQL Server 2016 and later loaded back into RichTextEdit from SQL Server. Is there a preferred approach for:

  1. Storing the .docx file in SQL Server?
  2. Reloading the SQL Server data stream into RichTextEdit?

Thanks.

Comments (1)
B B
Brendon Muck [DevExpress MVP] 7 years ago

    You may want to try the approach shown in the How to: Customize Built-in Command Using Service Substitution documentation topic. You can use that method to override the default handling of the open/save buttons wherein you can save/retrieve the .docx file as a blob to/from the database.

    Answers approved by DevExpress Support

    created 7 years ago

    Hi William,

    To load and save data from RichEditControl, you can bind it to an Rtf data column and handle the Rtf content saving/loading operations. You can find an example that illustrates how to accomplish this task here: How to use a RichEditControl in bound mode.

    Alternatively, convert data from your database to a stream and use the RichEditControl.LoadDocument and RichEditControl.SaveDocument methods to load data from a stream and save it.
    Please refer to the Load and Save to a Database thread for more information.

      Show previous comments (3)
      B B
      Brendon Muck [DevExpress MVP] 7 years ago

        I'm not really sure what you mean, given that the XtraReporting suite only operates in a Windows environment. You can load the .snx Snap File from a file system or database, insert your values at runtime and then export it to the following, most of which would work on any platform:

        DOC (Microsoft® Word® 97 - 2003 document).
        DOCX (Office® Open XML document);
        HTML (HyperText Markup Language);
        MHTML / MHT (Web archive, single file);
        PDF (Portable Document Format);
        RTF (Rich Text Format);
        TXT (Plain text);
        ODT (OpenDocument text format);
        XML (Microsoft® Word® XML document);
        Image (BMP, EMF, WMF, GIF, JPEG, PNG or TIFF format).

          Hello Brendon,

          The DevExpress documentation says that the XtraReport file is platform agnostic, meaning that the report file can be created using Winforms XtraReport, by way of example, then executed in a different platform (e.g. WPF, ASP.Net, etc.). I see from your comments that the Snap control is only a WinForms control, so snap reports could not be loaded from database in a WPF or ASP.Net application environment since this control is not available.

          B B
          Brendon Muck [DevExpress MVP] 7 years ago

            Ok, I misunderstood and though you were instead asking about compatibility with different operating systems. The Snap Document Server does allow you to programmatically create and work with Snap reports in a platform-agnostic way.

            Other Answers

            created 7 years ago (modified 7 years ago)

            Based on answers from Brendon / Ingvar will use the Snap control for he desired functionality.

              Comments (2)
              B B
              Brendon Muck [DevExpress MVP] 7 years ago

                Just keep in mind that if you were to use the Snap Document server that I mentioned below, you would need an appropriate Document Server license or Universal license.

                DevExpress Support Team 7 years ago

                  Here is a link to a webpage that lists all available subscription types:
                  Subscriptions

                  Please feel free to contact us if you have further questions.

                  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.