locked
RichEditBox Control's content is not properly aligned .

    Question

  • Hello,

    In Windows 8.1 metro app I am using RichEditBox .

    When I paste  content , its alignment gets disturb.

    Is there any solution?

    Here is the image.

    vikash singh


    • Edited by vikashs1000 Thursday, March 27, 2014 2:36 PM
    Thursday, March 27, 2014 2:32 PM

Answers

  • This was the response I got:

    You could set a table with a vertically formatted cell in RTF syntax and then load that into the document with the LoadFromStream method.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, April 03, 2014 2:11 PM
    Moderator
  • There's an entire protocol specification for RTF documents: http://www.biblioscape.com/rtf15_spec.htm

    What you do is create a table in RTF and load your text into one side and image in the other, and they will be vertically center aligned.   A really simple example without an image is this:

    MyRichEditBox.Document.SetText(TextSetOptions.FormatRtf, @"{\rtf1\ansi\deff0 \trowd \cellx1000 \cellx2000 \cellx3000 cell 1\intbl\cell cell 2\intbl\cell cell 3\intbl\cell \row } "); 




    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, April 04, 2014 5:17 PM
    Moderator

All replies

  • please explain more about what's going on. Can you post screenshots?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, March 27, 2014 8:44 PM
    Moderator
  • In this image , When i try to enter  text and symbol in RichEditBox they become base aligned . I want text "what is the result of  equation " comes vertically center aligned to Symbol or image in RichEditBox .

    I have used VerticalContentAlignment="Center" but it does not work.

    I have the same problem as this below link

    http://stackoverflow.com/questions/17541780/how-to-set-inline-images-vertically-center-in-richtextbox/22690092#22690092

    but this solution is not for windows metro app 8.1


    vikash singh



    Friday, March 28, 2014 5:59 AM
  • I'll ask about this.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, April 01, 2014 2:58 PM
    Moderator
  • This was the response I got:

    You could set a table with a vertically formatted cell in RTF syntax and then load that into the document with the LoadFromStream method.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, April 03, 2014 2:11 PM
    Moderator
  • Hello,

    I am facing the same problem. But your reply is not clear to me so please give me some example for that issue or sample code for that.

    Friday, April 04, 2014 6:02 AM
  • There's an entire protocol specification for RTF documents: http://www.biblioscape.com/rtf15_spec.htm

    What you do is create a table in RTF and load your text into one side and image in the other, and they will be vertically center aligned.   A really simple example without an image is this:

    MyRichEditBox.Document.SetText(TextSetOptions.FormatRtf, @"{\rtf1\ansi\deff0 \trowd \cellx1000 \cellx2000 \cellx3000 cell 1\intbl\cell cell 2\intbl\cell cell 3\intbl\cell \row } "); 




    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, April 04, 2014 5:17 PM
    Moderator