Hi,
Thank you for your inquiry.
Our product follows the Microsoft Word specification and only supports header adaptive text, not adaptive image size.I have achieved the following screenshot effect according to your requirements:
result.png
I put the complete code below for your referenece:
- Code: Select all
// Create a new document object
Document doc = new Document();
// Load the existing Word document
doc.LoadFromFile(@"E:\34986\header image\test1.docx");
// Get the header of the first section
HeaderFooter header = doc.Sections[0].HeadersFooters.Header;
// Add a new table to the header
Table table = header.AddTable(false);
// Reset the cells in the table
table.ResetCells(1, 1);
// Create a new paragraph and add it to the first cell of the first row of the table
Paragraph Para = table.Rows[0].Cells[0].AddParagraph();
// Append a picture to the paragraph
DocPicture image = Para.AppendPicture(@"E:\34986\2.png");
// Set the text wrapping style of the picture
image.TextWrappingStyle = TextWrappingStyle.Square;
// Append additional text to the paragraph
Para.AppendText("Reporting Project\r\nComputers and Structures, Inc.\r\nNovember 01, 2023\r\n");
// Save the modified document with the new header image
doc.SaveToFile(@"E:\\34986\\result8.docx", FileFormat.Docx2019);
If you have any issue just feel free to contact us.
Sincerely,
Ula
E-iceblue support team
Login to view the files attached to this post.