We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How can I add an image in the first page header section of a loaded docx?

Thread ID:





132995 Oct 3,2017 12:49 PM UTC Oct 4,2017 06:53 AM UTC WinForms 1
Tags: DocIO
deb kanti
Asked On October 3, 2017 12:49 PM UTC

I want to add an image in the header section of the first page in an already existing docx file. I am following the example syncfusion has in the "Working with Pages" section, though it is about creating a docs from scratch.I am getting the first section of the docx document, creating paragraphs, creating a byte array from an image, creating picture object from this image, and then appending the picture to the paragraph. My code is like that:

WordDocument document = new WordDocument(filePathFull);

IWSection section = document.Sections[0];

section.PageSetup.DifferentFirstPage = true;

IWParagraph paragraphQRCode = section.HeadersFooters.FirstPageHeader.AddParagraph();

paragraphQRCode.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Right;

// creating byte array from image


var picture = paragraphQRCode.AppendPicture(byteArrayImage);

picture.Width = 75;

picture.Height = 75;

document.Save("path", FormatType.DOCX);

But no image showing in the docx header? What am I missing?

Vijay Ramachandran [Syncfusion]
Replied On October 4, 2017 06:53 AM UTC

Hi Deb kanti,

Thank you for contacting Syncfusion support.

You can add the picture into first page header of the existing Word document and the given code snippet is works properly (Image preserved in result document) at our end. Please find the sample from here which is used at our end to test the current scenario.

We suspect that the issue may be occur due to any particular element preserved in the input Word document. So kindly provide us following details, thereby we will analyze further and provide you a prompt solution at the earliest.

    1. Input and Output Word documents.
    2. Image used at your end.
    3. Essential Studio product version.

Please let us know if you have any questions.

Vijay R


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon