我在创建Word文档的标题时遇到问题。
这是我的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;
页眉的文本必须左对齐,图像必须右对齐。
这是我在NPOI中的代码示例。我不知道下一步怎么办... 我尚未在互联网上找到有关NPOI Word C#的文档。有什么建议吗?
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 =