How to insert 2 pictures into the HEADER of a RadFlowDocument Word document

1 Answer 69 Views
Editor
Jimmy
Top achievements
Rank 1
Iron
Veteran
Jimmy asked on 03 Nov 2021, 10:21 AM

Anyone know how to adding 2 images in the header , one on the left and one on the right?

I try setting  defaultHeaderParagraph.Properties.TextAlignment.LocalValue = Alignme

 

nt.Justified; but it does not work

.

 both images still align to left.

 

Thanks in advance. 

 

 

 

 

1 Answer, 1 is accepted

Sort by
1
Accepted
Dimitar
Telerik team
answered on 04 Nov 2021, 12:04 PM

Hello Jimmy,

You need to use FloatingImage. Here is an example of this: 

var image_Stream = new MemoryStream(File.ReadAllBytes(@"..\..\tick.png"));

var document = new RadFlowDocument();
var header = document.Sections.AddSection().Headers.Add();
var paragraph = header.Blocks.AddParagraph();
var floatingImage1 = paragraph.Inlines.AddFloatingImage();
var floatingImage2 = paragraph.Inlines.AddFloatingImage();

floatingImage1.Image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(image_Stream, "png");
floatingImage2.Image.ImageSource = new Telerik.Windows.Documents.Media.ImageSource(image_Stream, "png");

floatingImage1.Image.Size = new Size(100, 100);
floatingImage2.Image.Size = new Size(100, 100);

floatingImage2.HorizontalPosition.Alignment = Telerik.Windows.Documents.Flow.Model.Shapes.RelativeHorizontalAlignment.Right;
floatingImage2.HorizontalPosition.ValueType = Telerik.Windows.Documents.Flow.Model.Shapes.PositionValueType.Alignment;

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Jimmy
Top achievements
Rank 1
Iron
Veteran
commented on 05 Nov 2021, 01:46 AM

Thanks Dimitar, it works.
Tags
Editor
Asked by
Jimmy
Top achievements
Rank 1
Iron
Veteran
Answers by
Dimitar
Telerik team
Share this question
or