Interop Word: zu Textmarke springen

07/04/2009 - 11:56 von Andreas Ahrens | Report spam
Hi NG,

wie springe ich in Word per Interop zu einer Textmarke?

Gruß
Andy
 

Lesen sie die antworten

#1 Frank Dzaebel
07/04/2009 - 17:43 | Warnen spam
Hallo Andreas,

wie springe ich in Word per Interop zu einer Textmarke?



Hier ein Beispiel:

object n = Type.Missing;

private void Form1_Load(object sender, EventArgs e)
{
string exePath = System.Windows.Forms.Application.StartupPath;
object docPath = Path.Combine(exePath, "Test.doc");
Word.Application app = new Word.Application();

// Word 10.0
Document doc = app.Documents.Open(ref docPath,
ref n, ref n, ref n, ref n, ref n, ref n, ref n,
ref n, ref n, ref n, ref n, ref n, ref n, ref n);
app.Visible = true;

object what = WdGoToItem.wdGoToBookmark;
object name = "TextMarke2"; // Beispiel
app.Selection.GoTo(ref what, ref n, ref n, ref name);

// [Selection.GoTo Method (Microsoft.Office.Interop.Word)]
//
http://msdn.microsoft.com/fr-fr/lib....goto.aspx

// ...
}


ciao Frank
Dipl. Inf. Frank Dzaebel [MCP, MVP C#]
http://Dzaebel.NET

Ähnliche fragen