Reputation: 83284
How to export pictures in Microsoft Word to TIFF file using Visual Studio Tools for Office? I can obtain a reference to the pictures as InlineShape object collection, the hard part now is how to save them as TIFF images.
Upvotes: 1
Views: 3529
Reputation: 83284
OK guys, I got the problem solved. Here's the code snippet:
private void SaveToImage(Word.InlineShape picShape, string filePath)
{
picShape.Select();
theApp.Selection.CopyAsPicture();
IDataObject data = Clipboard.GetDataObject();
if (data.GetDataPresent(typeof(Bitmap)))
{
Bitmap image = (Bitmap)data.GetData(typeof(Bitmap));
image.Save(filePath);
}
}
Hope it helps :)
Upvotes: 2
Reputation: 11436
Well. not sure if this is helpful, but you if you are okay with jpegs, then one really cool technique for extracting images from Word 2007 file is as follows:
Cheers.
Upvotes: 0