Click here to Skip to main content
15,895,084 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My C# Application interaction with Word Document using Microsoft.Office.Interop.Word. My Word Application having regular paragraph and also the range of the text in text box.So, I have easily accessed the particular paragraph and highlighted by the following way...

C#
int start = wordDoc.Paragraphs[st_para].Range.Start;
int end = wordDoc.Paragraphs[ed_para].Range.End;
Microsoft.Office.Interop.Word.Range r = wordDoc.Range(start, end);
r.Select();


But now i want to do the same thing for the text that are not part of the main body of the Word Document.for that i am using Microsoft.Office.Interop.Word.StoryRange in the following way:

C#
int start = wordDoc.StoryRanges....(Here i want to give the range like     paragraph)
         int end = wordDoc.StoryRanges......(Here i want to give the range like     paragraph)

         Microsoft.Office.Interop.Word.StoryRanges s = wordDoc.StoryRanges;
         Microsoft.Office.Interop.Word.Range r = s[WdStoryType.wdTextFrameStory];
         //r.SetRange(start, end);
         r.Select();

         while ((r = r.NextStoryRange) != null)
         {
             MessageBox.Show("text:"+r.Text);
             r.Select();
         }      


In the Above code iterate all the range of the text one bye one.But i want to get only particular text box value through start and end variable.
Please guide me to get of this issue...

Advance Thanks to All,
P.SARAVANAN.
Posted
Updated 5-Aug-11 18:33pm
v2

1 solution

I wanted to read document template(.dot)and export as msword( doc/docx) file

1. i wanted to update the checkbox field(true/false) and update the value in the textbox
2. wants to change the dropdown value
3. replace the shapes.

I used aspose.words and it is working fine for me for doing above steps. but it s costlier. so client wants free lib.
I tried the same things word interop from msoffice/dotnet but it is giving lot of issue & not able update the textfield.

giving RPC server is not available, any help really appreciated.

Thanks,
Haja
hajaworld@yahoo.co.in
 
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