So fügen Sie Text am Ende des Dokuments ein

Ich versuche, Text in das Word-Dokument einzufügen. Aber wenn ich meinen Code ausführe, wird der von mir in das Textfeld eingegebene Text immer am Anfang hinzugefügt. Ich kann den Text nicht am Ende des Dokuments einfügen. Ich kann dies nicht mit @ behebRange ebenfalls

private void button2_Click(object sender, EventArgs e)
    {
        try
        {
            if (textBox1.Text != "")
            {
                Microsoft.Office.Interop.Word._Application oWord;
                object oMissing = Type.Missing;
                oWord = new Microsoft.Office.Interop.Word.Application();
                oWord.Visible = false;
                oWord.Documents.Open(filePath);
                oWord.Selection.TypeText(textBox1.Text);
                oWord.ActiveDocument.Save();
                oWord.Quit();
                MessageBox.Show("The text is inserted.");
                textBox1.Text = "";
            }
            else
            {
                MessageBox.Show("Please give some text in the text box");
            }
        }
        catch(Exception)
        {
            MessageBox.Show("Please right click on the window and provide the path");
        }
    }

Antworten auf die Frage(4)

Ihre Antwort auf die Frage