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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

132995 Oct 3,2017 08:49 AM Oct 4,2017 02:53 AM Windows Forms 1
loading
Tags: DocIO
deb kanti
Asked On October 3, 2017 08:49 AM

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 02:53 AM

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.

Regards,
Vijay R
 


CONFIRMATION

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.

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.

;