Ticket T297310
Visible to All Users

The RichEdit control opens a specific document as empty

created 9 years ago

[DevExpress Support Team: CLONED FROM T295936: Spaces are being removed from a document on opening in RichEdit]
After applying the hotfix above, the attached document no longer displays.  I have been able to reproduce it in the Ribbon UI sample so it isn't specific to our code.  We urgently need this to be resolved so we can finish our release on time.
  Thanks,
     Troy

Answers approved by DevExpress Support

created 9 years ago

Hello,
The hotfix published in the T295936: Spaces are being removed from a document on opening in RichEdit thread cannot be the reason that the file is opened as empty.
The attached file contains text inside the shape. The RichEdit control doesn't support shapes. We have plans to support shapes in a future major release.
In the upcoming 15.2 release, this feature will not be implemented.
Should you have further questions, let me know.

    Show previous comments (5)
    DevExpress Support Team 9 years ago

      Hi Troy,

      Thank you for providing test files. I have reproduced the issue with a document crash in MS Office Word 2013. These document structures contain the following attribute sequence:   "w:lineRule="auto" w:line="0". According to the OpenXML format specification, the "auto" value of the "w:lineRule" attribute means that line spacing is calculated as 240 multiplied by the LineSpacingvalue (0 for these documents), and the resulting spacing is set to 0. Our RichEditControl overcomes this situation by setting the spacing to a default value, but MS Office Word crashes in this case.

      I have researched the  "T275690.zip" project and found the cause of the incorrect spacing settings. It appears that the order of assigning the LineSpacing and LineSpacingType properties values is incorrect with the ObjectExt.CopyFrom method. First, the LineSpacingTypeproperty value should be initialized. If the LineSpacing property value is set first, the LineSpacingType property is reset to "Multiple" irrespective of the actual value the property has. A similar rule applies to the FirstLineIndentTypeand FirstLineIndentproperties.

      From my point of view, it would be great to have a built-in API to copy default document settings (the Document.DefaultCharacterProperties, Document.DefaultParagraphProperties and Document.DefaultTableProperties properties). I will pass this idea to our developers.

      To fix the issue, change the RemoveEmptyPagesHelper.CopyDocumentDefaultSettings method to assign the aforementioned properties directly. See the code below for clarification:

      C#
      private void CopyDocumentDefaultSettings(Document source, Document target) { target.DefaultCharacterProperties.CopyFrom<CharacterPropertiesBase, CharacterPropertiesBase>(source.DefaultCharacterProperties); target.DefaultParagraphProperties.CopyFrom<ParagraphPropertiesBase, ParagraphPropertiesBase>(source.DefaultParagraphProperties); target.DefaultParagraphProperties.LineSpacingType = source.DefaultParagraphProperties.LineSpacingType; target.DefaultParagraphProperties.LineSpacing = source.DefaultParagraphProperties.LineSpacing; target.DefaultParagraphProperties.FirstLineIndentType = source.DefaultParagraphProperties.FirstLineIndentType; target.DefaultParagraphProperties.FirstLineIndent = source.DefaultParagraphProperties.FirstLineIndent; }

      >>  I believe the textbox is showing as a shape (Drawing Ribbon is showing up in Word) similar to the other file I sent. <<

      We don't aware of how MS Word detects shapes. However, after analyzing the provided documents structure we found that text boxes in these documents are written in the "-<mc:AlternateContent>" node, thus these objects are parsed by the RichEditControl as regular text boxes.

        I'm still working on this and it is a high priority.  I'm talking with the third party vendor that handles mailmerging the file.  I think they are changing the way the TextBox is added to the final document but this wasn't the case a week or two ago and we haven't changed any of their code that handles that.  I'm guessing another change in the code caused the template file used to mailmerge to cause this but haven't been able to isolate what that change was.  The template file is created in the richeditcontrol and then saved using it.  Once they can determine what change to the template file is causing them to change the way it is added in the final file I'll let you know and we can see what might be causing it.

        DevExpress Support Team 9 years ago

          Thank you for your feedback, Troy. We greatly appreciate your cooperation and efforts in researching this subject. Please do not hesitate to contact us if the issue occurs again.

          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.