Current filter:
                                You should refresh the page.
                                  • Dear Support,

                                    I'd like to copy the whole document from one RichEdit to another. However, when the source document has a date which auto-updates itself, it always refreshes after copying. Is there a way to copy only the text (and the formatting)?

                                    I attached a sample program, you can recreate my problem with these steps:
                                    - start the program
                                    - click the "Load document" button - it loads a word document which only contains an auto-updating date
                                    - modify the date in the left RichEdit, for example set the year to 2030
                                    - click the "Copy" button - it saves the left document to a stream and loads it to the right document
                                    - you can see in the right rich edit that the date corrected itself to the today's date

                                    I'm looking for a solution in which the date remains 2030 after copying.

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Bincze,
                                This happens because RichEditControl recalculates the Time field value. You can lock any document field to prevent its updates using the Field.Locked property. Set this option to true as shown below.

                                private void button1_Click(object sender, EventArgs e) { richEditControl1.LoadDocument("date.doc", DocumentFormat.Doc); richEditControl1.Document.Fields[0].Locked = true; }

                                You can also use the CTRL+F11 shortcut to lock the field from the UI.

                                • Bincze Tamas 01.14.2020

                                  What a quick and cool solution!
                                  Thank you, it works!

                                • Mariya (DevExpress Support) 01.14.2020

                                  You are always welcome! Please do not hesitate to contact us in the future.