I have a problem with creating the header of a Word document.
This is my code for Syncfusion:
WordDocument document = new WordDocument();
IWSection section = document.AddSection();
IWParagraph paragraph = section.HeadersFooters.OddHeader.AddParagraph();
//Appends the text to paragraph
string naglowek = "";
naglowek += ("...\n");
//naglowek += (""); //code...
IWTextRange textNaglowek = paragraph.AppendText(naglowek);
textNaglowek.CharacterFormat.FontName = "Times New Roman";
textNaglowek.CharacterFormat.FontSize = 9;
var imageBytesNaglowek = File.ReadAllBytes("wordHeader.png");
IWPicture naglowekObraz = paragraph.AppendPicture(imageBytesNaglowek);
naglowekObraz.VerticalOrigin = VerticalOrigin.TopMargin;
naglowekObraz.VerticalAlignment = ShapeVerticalAlignment.Top;
naglowekObraz.HorizontalOrigin = HorizontalOrigin.RightMargin;
naglowekObraz.HorizontalAlignment = ShapeHorizontalAlignment.Right;
naglowekObraz.TextWrappingStyle = TextWrappingStyle.Behind;
naglowekObraz.VerticalPosition = 5;
naglowekObraz.HorizontalPosition = -10;
The header must have text aligned to the left, and the image aligned to the right.
This is my code sample in NPOI. I do not know what's next ... I have not found documentation for NPOI Word C # on the internet. Any suggestions?
XWPFDocument doc = new XWPFDocument();
XWPFHeaderFooterPolicy docHeaderPolicy = doc.GetHeaderFooterPolicy();
XWPFHeader docHeader = docHeaderPolicy.CreateHeader(XWPFHeaderFooterPolicy.DEFAULT);
XWPFParagraph paragraphHeader = doc.CreateParagraph();
paragraphHeader.Alignment = ParagraphAlignment.LEFT;
XWPFRun runHeader = paragraphHeader.CreateRun();
string naglowek = "";
naglowek += (".....\n");
runHeader.SetText(naglowek);
//XWPFPicture picture =