I got an answer to my problem. In fact, it seems that Docx dll does not support displaying images in a table under the heading. Although they gave a method for displaying the image in the table, and also displayed on their blogs, but still I could not display the image using the table in the header section, which I can easily execute using the paragraph, as in the code below:
// Insert pic and text into the default Header. Novacode.Paragraph p1 = header_default.InsertParagraph(); p1.Direction = Novacode.Direction.LeftToRight; p1.AppendPicture(pic1);
And it works fine, but the problem arises when you have to display an image with some header text. Because we do not use a table to display the image, so it is difficult for you to correctly align both the image and the title text. After trying so many solutions and hard work, as I did not find support and solutions, in the end I found a solution to my problem. We can align both the header image and the header text in one row without using a table with data below one row:
p1.Append("Headertext").Bold().Position(30);
Using the Position() method, you can align both the header text and the header image on one line. Hope this helps someone too :).
source share