ms word document text box not shown in RichTextEditor

9 posts, 0 answers
  1. Salman
    Salman avatar
    5 posts
    Member since:
    Feb 2019

    Posted 18 Feb Link to this post

    I have a word file with the docx extension; it is used in the file from the text box of the msword .
    When I open the file by RichTextEditor, the text box controls are not displayed.
  2. Hristo
    Admin
    Hristo avatar
    1506 posts

    Posted 18 Feb Link to this post

    Hi Salman,

    Content controls are currently not supported in the RadRichTextEditor. We have a feature request logged on our feedback portal, here: https://feedback.telerik.com/winforms/1370689-add-radrichtexteditor-implement-support-for-content-controls. You can subscribe to it and be updarted when its status changes.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Salman
    Salman avatar
    5 posts
    Member since:
    Feb 2019

    Posted 18 Feb in reply to Hristo Link to this post

    I want to put some text in the header of my document in an irregular manner, which seems to be done only through the textbox.
    Is there a substitution method?
  4. Salman
    Salman avatar
    5 posts
    Member since:
    Feb 2019

    Posted 18 Feb in reply to Hristo Link to this post

    I want to put some text in the header of my document in an irregular manner, which seems to be done only through the textbox.
    Is there a substitution method?
  5. Hristo
    Admin
    Hristo avatar
    1506 posts

    Posted 19 Feb Link to this post

    Hi Salman,

    The headers and footers are working with their own RadDocument. You can check the following documentation article with more details on how the headers and footers can be manipulated: https://docs.telerik.com/devtools/winforms/controls/richtexteditor/features/headers-and-footers.

    Let me know if you have other questions.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  6. Salman
    Salman avatar
    5 posts
    Member since:
    Feb 2019

    Posted 19 Feb in reply to Hristo Link to this post

    Please see the attached image. As you can see, I want to write several texts in this way in my document. Apparently, there is no other way to do this except using the textbox.
  7. Hristo
    Admin
    Hristo avatar
    1506 posts

    Posted 19 Feb Link to this post

    Hi,

    A similar header can be achieved programmatically by arranging TextBlock elements in floating UI containers: 
    private void radButton1_Click(object sender, EventArgs e)
    {
        TextBlock textBlock = new TextBlock()
        {
            Text = "Some Text",
            FontSize = 16,
            FontFamily = new Telerik.WinControls.RichTextEditor.UI.FontFamily("Calibri"),
            PositionOffset = new System.Drawing.SizeF(0, 20)
        };
     
        FloatingUIContainer uiContainer = new FloatingUIContainer(textBlock, new Telerik.WinControls.RichTextEditor.UI.Size(75, 25));
     
        TextBlock textBlock2 = new TextBlock()
        {
            Text = "Some Text 2",
            FontSize = 16,
            FontFamily = new Telerik.WinControls.RichTextEditor.UI.FontFamily("Calibri"),
            PositionOffset = new System.Drawing.SizeF(200, 0)
        };
     
        FloatingUIContainer uiContainer2 = new FloatingUIContainer(textBlock2, new Telerik.WinControls.RichTextEditor.UI.Size(75, 25));
     
        TextBlock textBlock3 = new TextBlock()
        {
            Text = "Some Text 3",
            FontSize = 16,
            FontFamily = new Telerik.WinControls.RichTextEditor.UI.FontFamily("Calibri"),
            PositionOffset = new System.Drawing.SizeF(400, -20)
        };
     
        FloatingUIContainer uiContainer3 = new FloatingUIContainer(textBlock3, new Telerik.WinControls.RichTextEditor.UI.Size(75, 25));
     
        Paragraph paragraph = new Paragraph();
        paragraph.Inlines.Add(uiContainer);
        paragraph.Inlines.Add(uiContainer2);
        paragraph.Inlines.Add(uiContainer3);
        Section section = new Section();
        section.Blocks.Add(paragraph);
        RadDocument commentBody = new RadDocument();
        commentBody.Sections.Add(section);
     
        Header header = new Header() { Body = commentBody, IsLinkedToPrevious = false };
        this.radRichTextEditor1.UpdateHeader(this.radRichTextEditor1.Document.Sections.First, HeaderFooterType.Default, header);
    }

    Please note that this header only consists of UI elements and these elements will not be persisted in the document if it later exported, e.g. to Word.

    I am also attaching a screenshot showing the result on my end. I hope this will help.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  8. Salman
    Salman avatar
    5 posts
    Member since:
    Feb 2019

    Posted 20 Feb in reply to Hristo Link to this post

    thanks for your answer.
    But, in my own word processor, I put a header that comes with the photo. With the code you wrote, it was deleted from my previous header containing the image. My word document is designed to have one or more images embedded in the header, and for some reason it should not be done through coding.
  9. Hristo
    Admin
    Hristo avatar
    1506 posts

    Posted 20 Feb Link to this post

    Hi Salman,

    Currently, such a header cannot be achieved through the UI. Please subscribe to the feature request about the content controls feature so that you can be updated when the status of the item changes.

    Regards,
    Hristo
    Progress Telerik
    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top