text and graphics processing. (Word & C#)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've go problem!
I want my word plug-in to cut all pictures from the document, and then paste
them back.

for (i = 1; i <= applicationObject.ActiveDocument.Paragraphs.Count; i++)
{
????
}

what shall I do?
thanks
 
Hi Evgeniy

There are two collections in Word that control pictures. To understand why,
see:
The draw layer: a metaphysical space
http://www.word.mvps.org/FAQs/DrwGrphcs/DrawLayer.htm

First, there is a Shape object. All Floating objects and inline AutoShapes
are of type Shape. The collections that govern them are the ShapeRange and
Shapes collection. If myDoc is a document, and myRange is a range, then In
VBA terms:

Dim myShape as Shape
Set myShape = myDoc.Shapes(1)
Set myShape = myRange.ShapeRange(1)

There is also an InLineShape object. All Inline objects *except* inline
AutoShapes are of type InLineShape. And they are found in the InLineShapes
collection. So in VBA terms:

Dim myILS as InLineShape
Set myILS = myDoc.InLineShapes(1)
Set myILS = myRange.InlineShapes(1)

So you'll need to cycle through both Shapes and InLineShapes collections.
Word's VBA help has more info on these.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 
Back
Top