Frage

Ich bin mit Word Automation ein Dokument aus meiner Anwendung zu erstellen, und ich brauche drei Unterschriften der Fußzeile eines Dokuments hinzuzufügen. Das ist einfach, jedoch bekommen sie erscheinen als Ich mag würde nicht funktionieren.

Hier ist der Code verwende ich:

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

Hier ist, was es produziert (Ich habe Anmerkungen hinzugefügt) Ergebnisse

Hier ist, was ich will Gewünschte Response

Was muss ich tun?

War es hilfreich?

Lösung

ich es geschafft, die Ausgabe Incase jemand läuft in dieses Problem zu beheben. Ich folgte den Anweisungen hier: http://support.microsoft.com/kb/316384 erstellen eine einzelne Zeile, sechs Spalte Tabelle.

Wenn jemand versucht, dies zu tun, vergessen Sie nicht, dass Wort Automatisierung im Wesentlichen Visual Basic ist, so dass, wenn die Tabellenzellen Adressierung, Indizes bei 1 beginnen, nicht 0 ist.

Hinzufügen von Text funktioniert wie im Beispiel:

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

und das Hinzufügen von Bildern funktioniert wie es vorher war, außer dieser Zeit ist der Bereich Ihrer Zelle:

oTable.Cell(1, 1).Range.InlineShapes.AddPicture(plaintiffInitialFile, ref oMissing, ref oTrue, ref oMissing);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top