This question might sound very simple but I am unable to find any Solution for it.What I am trying to do is to Move my Cursor Positon in MsWord to the end of the text.My code is as follows
object StartPos = 0;
object Endpos = 1;
Microsoft.Office.Interop.Word.Range rng= oDoc.Range(ref StartPos, ref Endpos);
rng.Text = "This is first line Word from C#";
The output is
I This is first line Word from C#
however i want something like this
This is first line Word from C# I
Thanks All
Well thank you all for your response I seem to have figured out a simple Solution.I tried to modify Hassan's Solution.There might be a much easier approach but as of now I have Found This
object NewEndPos = rng.StoryLength-1;
rng = oDoc.Range(ref NewEndPos, ref NewEndPos);
rng.Select();
How about this? It's the same as pressing Ctrl-Shift-End. Note that word
is the word application, not the document. It's assumed that the correct active document is already selected.
word.Selection.EndKey(WdUnits.wdStory);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With