2010-11-05 99 views
0

我正在使用Word Automation从我的应用程序创建文档,并且需要将三个签名添加到文档的页脚。然而,这很容易让他们出现,因为我想不起作用。将三个对齐图像添加到word文档页脚

下面是我使用的代码:

  //add initials to footer 
      if (oWordDoc.Sections.Count > 0) { 
       Range r = oWordDoc.Sections[1].Footers[WdHeaderFooterIndex.wdHeaderFooterPrimary].Range; 
       Object colapseDir = WdCollapseDirection.wdCollapseStart; 
       r.Collapse(ref colapseDir); 

       oWord.ActiveWindow.View.Type = WdViewType.wdPrintView; 
       oWord.ActiveWindow.ActivePane.View.SeekView = WdSeekView.wdSeekCurrentPageFooter; 
       oWord.Selection.TypeParagraph(); 

       oWord.Selection.Paragraphs.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; 
       oWord.ActiveWindow.Selection.Font.Name = "Arial"; 
       oWord.ActiveWindow.Selection.Font.Size = 8; 


       if (!String.IsNullOrEmpty(plaintiffInitialFile)) { 
        r.InlineShapes.AddPicture(plaintiffInitialFile, ref oMissing, ref oTrue, ref oMissing); 
       } 

       oWord.ActiveWindow.Selection.TypeText("Plaintiff's Initals"); 
       oWord.ActiveWindow.Selection.TypeText("\t"); 


       if (!String.IsNullOrEmpty(plaintiffAttInitialFile)) { 
        r.InlineShapes.AddPicture(plaintiffAttInitialFile, ref oMissing, ref oTrue, ref oMissing); 
       } 

       oWord.ActiveWindow.Selection.TypeText("Plaintiff's Attorney's Initals"); 
       oWord.ActiveWindow.Selection.TypeText("\t"); 


       if (!String.IsNullOrEmpty(ekfgInitialFile)) { 
        r.InlineShapes.AddPicture(ekfgInitialFile, ref oMissing, ref oTrue, ref oMissing); 
       } 

       oWord.ActiveWindow.Selection.TypeText("EKFG's Initals"); 
      } 

这里是它是生产什么(我已经添加了注解) Results

这里就是我想要的 Desired Response

什么我需要做什么?

回答

0

我设法解决任何人遇到这个问题的问题。我遵循这里的说明:http://support.microsoft.com/kb/316384创建一个单行,六列表。

如果别人试图做到这一点,不要忘了这个词的自动化实质上是Visual Basic中,所以解决的表格单元格时,指数从1开始,不是0

添加文本就像在本例:

oTable.Cell(1, 2).Range.Text = "Plaintiff's Initials"; 

,并添加图像就像它以前,不同的是这次的范围是你的:

oTable.Cell(1, 1).Range.InlineShapes.AddPicture(plaintiffInitialFile, ref oMissing, ref oTrue, ref oMissing); 
相关问题