0
我正在建立一个word文档的编程方式,最后我要做的是添加一个标题,其中包含一个图像左侧的标题在中间。添加多个项目到标题Microsoft.Office.Interop.Word
我尝试了各种不同的东西,但没有任何工作。我已经尝试向表头添加一个表头(这引发了一个异常)。我试图添加图像,然后添加文本,但这只是使文本出现,而不是图像。我曾尝试将新字段添加到标题范围,但这也不起作用。
难道有人指出我正确的方向吗?
//Add header into the document
foreach (Section section in document.Sections)
{
//Get the header range and add the header details.
Range headerRange = section.Headers
[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
headerRange.InlineShapes.AddPicture(@"C:\Development\Tools\CommentParser\CommentParser\HeaderLogo.png");
headerRange.Font.ColorIndex = WdColorIndex.wdBlue;
headerRange.Font.Size = 10;
headerRange.Text = "Title";
}