2010-11-05 106 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); 
相關問題