This is a migrated thread and some comments may be shown as answers.

Creating letterpaper in a document

1 Answer 75 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 04 Nov 2015, 03:45 PM

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

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 09 Nov 2015, 01:02 PM
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 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
Tags
RichTextBox
Asked by
Alex
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or