word dude...

  • Thread starter Thread starter Juan Antonio
  • Start date Start date
J

Juan Antonio

Hi to the forum...

I have this code that allows to me the access to the text
of each paragraph, in a word document:

foreach Word.Paragraph x in myapp.ActiveDocument.Paragraphs
{
MessageBox.Show("this is the paragraph="+x.Range.Text);
}

I would like to know (if its possible), to make another
foreach statement, inside the before, make possible the
access to each word inside each paragraph...

For the moment i try this (inside the before foreach):

foreach(Word.Words w in x.Range.Words)
{
MessageBox.Show("test");
}

But only obtain an Exception Specific Cast Not Valid...

Anybody Could tell me how can i solve my question??
Thanks in advance.
Kind Regards.
Juan Antonio.
 
if it's a sequentially indexed collection, try the following

for ( int x = 0; x < Range.Words.Count; x ++ )
{
Words.Words mynewWord = Range.Words[x];
MessageBox.Show("gud day mate " + mynewWord.Text );
}


note that Range.Words.Count may be Range.Words.Length, depending on the
structure.

Dan.



Hi to the forum...

I have this code that allows to me the access to the text
of each paragraph, in a word document:

foreach Word.Paragraph x in myapp.ActiveDocument.Paragraphs
{
MessageBox.Show("this is the paragraph="+x.Range.Text);
}

I would like to know (if its possible), to make another
foreach statement, inside the before, make possible the
access to each word inside each paragraph...

For the moment i try this (inside the before foreach):

foreach(Word.Words w in x.Range.Words)
{
MessageBox.Show("test");
}

But only obtain an Exception Specific Cast Not Valid...

Anybody Could tell me how can i solve my question??
Thanks in advance.
Kind Regards.
Juan Antonio.
 
Back
Top