0

Word Automation を使用してアプリケーションからドキュメントを作成しています。ドキュメントのフッターに 3 つの署名を追加する必要があります。それは簡単ですが、私が望むようにそれらを表示させることはうまくいきません。

私が使用しているコードは次のとおりです。

            //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");
            }

これが生成しているものです(注釈を追加しました) 結果

これが私が欲しいものです 望ましい対応

私は何をする必要がありますか?

4

1 に答える 1

0

誰かがこの問題に遭遇した場合に備えて、問題を修正できました。http://support.microsoft.com/kb/316384の指示に従って、1 行 6 列のテーブルを作成しました。

他の誰かがこれを行おうとしている場合は、ワード オートメーションは本質的に Visual Basic であることを忘れないでください。したがって、テーブル セルをアドレス指定するとき、インデックスは 0 ではなく 1 から始まります。

テキストの追加は、例のように機能します。

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

画像の追加は以前と同じように機能しますが、今回は範囲がセルです:

oTable.Cell(1, 1).Range.InlineShapes.AddPicture(plaintiffInitialFile, ref oMissing, ref oTrue, ref oMissing);
于 2010-11-08T16:27:24.183 に答える