Free Support Forum - aspose.com

Words.NET 4.0

The insert image syntax seems to have changed.

You can no longer call builder.InsertImage(strPath, 200, 200, null)

Now it seems to look for a stream, a path or an image object. My question is how to insert an image of a particular size (in the previous code 200x200).

Without this the function is unusable for me since the image would be too big at its native size.

Please help, this is holding up the project.

Yes. DocumentBuilder.InsertImage overloads were simplified, otherwise they were getting out of control. There is a lot more you can do now with images and in fact much easier than before. In your example you need to:

Shape shape = builder.InsertImage(myFileName);

shape.Width = 200;

shape.Height = 200;

you can also do other things:

shape.AlternativeText = "this is my image".

shape.WrapType = WrapType.None;

shape.Left = 10;

shape.Top = 50;

shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;

and so on.

I hope you will enjoy it.

We will write an article describing exactly what changes in the API were breaking. There weren't many. It was actually one of the main changes that some of the DocumentBuilder.InsertImage overloads were removed.

So where is the object Shape defined?

All shapes and graphics related classes and enumerations are in the new Aspose.Words.Drawing namespace.

Check the updated API Reference http://www.aspose.com/Products/Aspose.Words/Api/index.html