Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

Get a style marked word/s from a paragraph

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
inpuarg - 29 Apr 2006 17:37 GMT
I have some paragraphs in a word document. Looks like :

P1 :
XXX YYY    rest of the text

P2 :
XXX    rest of the text

P3 :
XXX YYY ZZZ rest of the text

P4 :
XXX rest of the text

XXX , YYY , ZZZ are marked with  WORDNNN   style. rest of the text are normal
style. there are no any delimiter between them.

So - i know the style's name. Can i parse , marked as WORDNNN style text ? and
get XXX ? Is it possible ?
Jezebel - 29 Apr 2006 17:40 GMT
Find will retrieve text based on style.

>I have some paragraphs in a word document. Looks like :
>
[quoted text clipped - 17 lines]
> and
> get XXX ? Is it possible ?
inpuarg - 29 Apr 2006 18:00 GMT
could you please give me more detail ?
That FIND method  - is the method of which class ?

Document.Find or Application.Find or Content.find or Style.Find or ?

(by the way - i am using c# 2005 )

>Find will retrieve text based on style.
inpuarg - 29 Apr 2006 18:12 GMT
I have only this :(

           Microsoft.Office.Interop.Word.Range c = this.Paragraphs[1].Range;

msdn sucks. no sample . no detail. nothing.

>could you please give me more detail ?
>That FIND method  - is the method of which class ?
[quoted text clipped - 4 lines]
>
>>Find will retrieve text based on style.
Charles Kenyon - 29 Apr 2006 18:58 GMT
You need to learn how Word works before you start trying to program it.
Sorry. That is just how it is.

Try within Word recording a macro that searches for your style and examine
the code.

Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> could you please give me more detail ?
> That FIND method  - is the method of which class ?
[quoted text clipped - 4 lines]
>
>>Find will retrieve text based on style.
Jezebel - 30 Apr 2006 03:04 GMT
If you can't use Help to understand the Find object, your project is doomed
from the start.

> could you please give me more detail ?
> That FIND method  - is the method of which class ?
[quoted text clipped - 4 lines]
>
>>Find will retrieve text based on style.
inpuarg - 01 May 2006 09:48 GMT
I've found the solution but not so easy.
Before chm help  , or earlier version of MSDN Library , Microsoft was working
for supplying a good help document. At least for main methods , like Find method
, there was a sample.
I am using c# 2005 , VSTO2005 and related MSDN Library. There is no any sensible
explanation or sample.

   public partial class ThisDocument
   {
       Microsoft.Office.Interop.Word.Selection activeSelection = null;
       Microsoft.Office.Interop.Word.Range range = null;
       private void ThisDocument_Startup(object sender, System.EventArgs e)
       {
           this.SelectionChange += new
Microsoft.Office.Tools.Word.SelectionEventHandler(ThisDocument_SelectionChange);

           for (int i = 1; i < this.Paragraphs.Count+1; i++)
           {
               range = this.Paragraphs[i].Range;
               range.Select();
               string word = "";
               string response = "";
               bool ret = parseWordAndResponse(ref word, ref response);
               ret = insertWordToDatabase(word, response);
           }

       private void ThisDocument_SelectionChange(object sender,
Microsoft.Office.Tools.Word.SelectionEventArgs e)
       {
           activeSelection = e.Selection;
       }

C#
public interface Find

Word Primary Interop Assembly Reference  
Find.Execute Method  

Runs the specified find operation.
Namespace: Microsoft.Office.Interop.Word
Assembly: Microsoft.Office.Interop.Word (in microsoft.office.interop.word.dll)

bool Execute(
    [In, Optional] ref object FindText,
    [In, Optional] ref object MatchCase,
    [In, Optional] ref object MatchWholeWord,
    [In, Optional] ref object MatchWildcards,
    [In, Optional] ref object MatchSoundsLike,
    [In, Optional] ref object MatchAllWordForms,
    [In, Optional] ref object Forward,
    [In, Optional] ref object Wrap,
    [In, Optional] ref object Format,
    [In, Optional] ref object ReplaceWith,
    [In, Optional] ref object Replace,
    [In, Optional] ref object MatchKashida,
    [In, Optional] ref object MatchDiacritics,
    [In, Optional] ref object MatchAlefHamza,
    [In, Optional] ref object MatchControl
);
Charles Kenyon - 01 May 2006 16:15 GMT
Again, this newsgroup is about vba, not vb, not C.
vba's help has nice information on Find, including examples. However, it is
on the Find object, rather than a Find method.

Before trying to program Word, learn Word.
Signature

Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome!

My criminal defense site: http://addbalance.com
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.

> I've found the solution but not so easy.
> Before chm help  , or earlier version of MSDN Library , Microsoft was
[quoted text clipped - 60 lines]
> [In, Optional] ref object MatchControl
> );
inpuarg - 10 May 2006 13:41 GMT
i know word. i don 't have to learn vba. i am programming c#.
if vba has a good documentation this is good for you.
i am simply demanging the same :)

my only mistake was sending this issue to this group . that 's all .

i even don 't have to know word. if you want developers to improve your product
with some add-ins , macros , you have to provide a good documentation. and in
msdn .net help theese are not provided. that was all that i 'm critizing.

>Again, this newsgroup is about vba, not vb, not C.
>vba's help has nice information on Find, including examples. However, it is
>on the Find object, rather than a Find method.
>
>Before trying to program Word, learn Word.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.