Current filter:
                                You should refresh the page.
                                  • Hi Team,
                                    We are facing  below issue while replacing the Field Code values to  the normal text at run time

                                    The Field Code styles are not reflecting on the Field Value except Font Name and Font Size.

                                    We are using "DevExpress.XtraRichEdit.API.Native.CharacterProperties" for getting Field Code properties in my code.

                                    Please help me on the above issue, this is very critical for us.

                                    Thanks,
                                    Nageswara Rao P

                                Show all comments
                                • Helen (DevExpress Support) 10.10.2019

                                  Hello Nageswara,

                                  To provide you with a proper solution, we need to reproduce the problem on our side. Would you please send us a simple runnable project illustrating the problem?

                                  Alternatively, provide us with the following to help us create a sample on our side:

                                  • A test document or data source that you modify with your custom styles;
                                  • The complete code that performs the styles' modifications;
                                  • A couple of screenshots with the current and expected output.
                                • Nageswara Rao Pendela 10.17.2019

                                  Hi Helen,
                                  As per above comment, we are providing the sample code files and Pdf document,
                                  Please check and let us know.

                                  Thanks,
                                  Nageswara Rao P

                                • Helen (DevExpress Support) 10.17.2019

                                  Hi Nageswara,

                                  Thank you for the files. I tried to re-create the problem in a sample project and found that the control loads the source document from an external path:

                                  [C#]
                                  string path = System.Configuration.ConfigurationManager.AppSettings["SourcePath"]; ... DocumentServer.LoadDocument(path, DevExpress.XtraRichEdit.DocumentFormat.OpenXml);

                                  Later, you are working with this document fields in code, but I don't see that you are applying font styles in code. So I assume that the initial styles are taken from the original document. To research why the styles are modified in RichEdit, I need to research the original document as well. However, your attachment contains a PDF document, not a Word one. So I'm not sure how to use it.
                                  Could you please send me a test document that illustrates the problem?

                                • Nageswara Rao Pendela 10.17.2019

                                  Hi Helen,
                                  Thanks for quick response.
                                  I am attaching word documents(Before.docx and After.docx) in the attachment.
                                  Please check and let us know the response.

                                  This is very critical  to us, Please consider this is high priority.

                                  Thanks,
                                  Nageswara Rao P

                                • Helen (DevExpress Support) 10.18.2019

                                  Hi,

                                  I reproduced this behavior. We may need additional time to research it and will update this thread once we have any news.

                                • Nageswara Rao Pendela 10.18.2019

                                  Thank you Helen, we are waiting for your valuable response.

                                  Thanks,
                                  Nageswara Rao

                                1 Solution

                                Creation Date Importance Sort by

                                Hello Nageswara,
                                Note that inserted content merges its formatting with the target formatting. In the current scenario, you can simply append the required text at the end of the field and then, remove the field range (without coping formatting manually).

                                [C#]
                                for (int Ri = DocFields.Count - 1; Ri >= 0; Ri--) { Field DocField = DocFields[Ri]; DocField.ShowCodes = true; string FieldName = WordDocument.GetText(DocField.CodeRange); var text = "test value"; DocumentPosition FieldPosition = DocField.Range.End; WordDocument.InsertText(FieldPosition, text); WordDocument.Delete(DocField.Range); }

                                I also need to mention that it isn't correct to assign a CharacterProperties instance to a different CharacterProperties instance if you want to apply the same character properties to a different range. You can use the CharacterProperties.Assign method to copy settings between two different CharacterProperties instances. Note that when the source range is deleted, the CharacterProperties class loses actual settings. So, if you remove the source field range (the range you passed to the BeginUpdateCharacters method) before inserting the new content, you will not be able to copy formatting to a new range since the CharacterProperties data isn't actual any more. You can follow these steps to properly copy formatting between any two ranges (if the source range should be removed):

                                1. Obtain CharacterProperties for the first range;
                                2. Insert a new range;
                                3. Obtain CharacterProperties for the second (newly-inserted) range;
                                4. Copy the formatting using the CharacterProperties.Assign method;
                                5. Remove the first range.
                                I hope that you find this information helpful.
                                • Nageswara Rao Pendela 10.18.2019

                                  Thank you Mariya for your quick response.
                                  We will connect with our team and get back to you if any.

                                  Thanks,
                                  Nageswara Rao

                                • Mariya (DevExpress Support) 10.18.2019

                                  You are welcome.