Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi All,

We are developing C#.net4.0 Windows form based application using MicroSoft.office.interop.Word reference.Now i want to move the position of the cursor to the particular paragraph.How i do it?


Thanks & Regards,
P.SARAVANAN
Posted
Comments
Sergey Alexandrovich Kryukov 31-May-11 13:48pm    
Banned on Google?
--SA

1 solution

You use the Select method to set the cursor position in a Word document. Normally the Select method will be used to highlight a range of text, but if you use the same start and end positions in the Range property it just sets the cursor position.

Your code would look something like this:
using Word=Microsoft.Office.Interop.Word;
...
Word.Document wordDoc = ..... // Obtain reference to Word document we want to set the cursor position of
wordDoc.Range(10, 10).Select(); // The Range property identifies a position in the document, and the Select call moves the cursor there


This will move the cursor to the 10th character in your document.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900