Linking elements so they can't be split by a page break

9 posts, 0 answers
  1. ric
    ric avatar
    22 posts
    Member since:
    Apr 2011

    Posted 05 Nov 2013 Link to this post

    Is this possible or supported? Are there any workarounds?

    Essentially we might, for example, have a heading followed by an image. But occasionally the auto-page wrapping can split them up, so that the heading and images essentially have a page break in between. It'd be nice to be able to link them somehow to prevent this happening
  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 08 Nov 2013 Link to this post

    Hello,

    You can try inserting a non-breaking space between the elements, for example with the Alt+0+1+6+0 shortcut. However, please note that at this point non-breaking spaces are not fully supported and they will not be preserved on export/import roundtrips to DOCX. You can track the availability of the feature here.

    I hope this helps!

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. DevCraft banner
  4. ric
    ric avatar
    22 posts
    Member since:
    Apr 2011

    Posted 08 Nov 2013 Link to this post

    I've tried that and don't think it's what we need, while it does prevent items that are inline from being separated by a page break it won't help us force two items that are NOT inline (e.g. text, line break, then image) to always appear on the same page

    EDIT: appears that MS-Word supports paragraphs (AKA block items) to have "keep with next" set, do you support something similar? http://support.microsoft.com/kb/233493
  5. ric
    ric avatar
    22 posts
    Member since:
    Apr 2011

    Posted 11 Nov 2013 Link to this post

    I've been working on a workaround. But am having trouble with document positions. Specifically I want to remember the caret position then refer to it later  (to see if I'm still on the same page) but if I do

    dim startPosition as New DocumentPosition(editor.Document.CaretPosition) 

    and then move the Caret the above variable changes! I want a snapshot so I can put the caret back when I've finished. How do I do that?

  6. Petya
    Admin
    Petya avatar
    975 posts

    Posted 11 Nov 2013 Link to this post

    Hi,

    Keep with next functionality is not currently available in RadRichTextBox. The feature is in our to-do list, but it is not scheduled, so I cannot tell when it might be implemented.

    As for your other questions, the method you are using to copy the caret position might indeed cause the observed problem. I suggest you create the copy as follows instead:
    Dim startPosition As New DocumentPosition(editor.Document)
    startPosition.MoveToPosition(editor.Document.CaretPosition)

    Let us know if you have other questions.

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  7. ric
    ric avatar
    22 posts
    Member since:
    Apr 2011

    Posted 11 Nov 2013 Link to this post

    Thanks, yes, that did the trick. I'm putting start and end marker strings in the document, using textsearch to find them then if both positions are on different pages inserting a page break. 
  8. Petya
    Admin
    Petya avatar
    975 posts

    Posted 12 Nov 2013 Link to this post

    Hello,

    I'm glad to hear my answer was helpful!

    I just wanted to follow-up on this and mention that RadRichTextBox's document model allows inserting elements which are not visually represented and can be used for semantic purposes - annotations. Moreover, you can easily create a custom annotation and will not have to insert marker strings in the document. For more information you can check this help article.

    I hope this helps!

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  9. ric
    ric avatar
    22 posts
    Member since:
    Apr 2011

    Posted 12 Nov 2013 Link to this post

    Thanks, that looks interesting, though I can't find a way of getting a DocumentPosition from a RangeStart instance?
  10. Petya
    Admin
    Petya avatar
    975 posts

    Posted 12 Nov 2013 Link to this post

    Hi,

    Annotation markers are Inline document elements, so you can simply use the MoveToInline() method of DocumentPosition:
    DocumentPosition pos = new DocumentPosition(this.radRichTextBox.Document);
    pos.MoveToInline(annotationStart);

    Do not hesitate to get back to us if you have other questions.

    Regards,
    Petya
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
DevCraft banner