Creating letterpaper in a document

2 posts, 0 answers
  1. Ates
    Ates avatar
    15 posts
    Member since:
    Nov 2010

    Posted 04 Nov 2015 Link to this post

    Hello,

    I am trying to set up a letterpaper in the RadRichTextbox, however I am not having much success (see code).

    RadDocument document = new RadDocument();
    Header header = new Header() { Body = document, IsLinkedToPrevious = false };
    var section = new Telerik.Windows.Documents.Model.Section();
    section.HasDifferentFirstPageHeaderFooter = true;
    section.PageSize = PaperTypeConverter.ToSize(PaperTypes.A4);
    document.Sections.Add(section);

    var paragraph = new Telerik.Windows.Documents.Model.Paragraph();
    ImageInline image = new ImageInline(stream);

    FloatingImageBlock imageBlock = new FloatingImageBlock();
    imageBlock.ImageInline = image;
    imageBlock.WrappingStyle = WrappingStyle.BehindText;
    paragraph.Inlines.Add(imageBlock);

    document.Sections.First().Children.Add(paragraph);
    this.TextEditor.UpdateHeader(document.Sections.First(), HeaderFooterType.Default, header);

    I am seeing the image in the header with this code, however not filling in the whole page. If I then click in the header and press Enter on the keyboard the full page length image is displayed. With pressing Enter a second time the image dissappears again. In addition I am unsure how I can place a differing image for the follow up pages.

    My goal is to acheive the following points in order to be able to use this letterpaper:
    - Image fills the page (imagesize = pagesize)
    - Image ​on first page is ​differing to the other pages
    - Margins of the first page are differing to the other pages

     

    Sincerly

    A.Kasar

  2. Todor
    Admin
    Todor avatar
    168 posts

    Posted 09 Nov 2015 Link to this post

    Hello Ates,

    Thank you for the detailed information.

    Indeed, I was able to reproduce the unexpected behaviour when a floating image is inserted in the header of the document and its content is edited later. I've already logged this in our internal bug tracking system. Unfortunately, I cannot commit to a specific timeframe when the fix will be available. For now, I can suggest you to follow the related item in our feedback portal in order to be notified about any related changes.

    As a workaround and as a different approach to achieve the desired goal, you could insert different sections in the document and to set different watermarks (depending on the image) and properties (page margins, page size and etc.) for those sections.

    Sorry for the caused inconvenience.
    In appreciation of reporting this, I've added some Telerik points into your account.

    If you need further assistance, please get back to us again.

    Regards,
    Todor
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top