Quantcast
Channel: Word for Developers forum
Viewing all articles
Browse latest Browse all 4350

Issue While Extract the Embedded Object present inside word 2010 file.

$
0
0
Dear Friends,

I have developed application c#.Net 2008, 

Step 1. It will open the word file and find the embedded object(*.m file) in it.

Step 2. That embedded object (*.m file) is copied to clipboard.

Step 3. Getting the embedded object(*.m file) from clipboard.

Step 4. Reading the embedded object(*.m file) content and saving it back to hard disk as (*.m) file.

My application is worked fine for word 2003 and files are got saved in hard disk, but the issue is application fails for word 2010.

My application fails for word 2010 for Step 3.

Following code works for word 2003 but fails for word 2010.

foreach (Word.InlineShape inlineShape in wordDoc.InlineShapes)
{
 Clipboard.Clear();
 outputFile = null;
if (inlineShape.Type == Word.WdInlineShapeType.wdInlineShapeEmbeddedOLEObject)
{
if (inlineShape.OLEFormat != null)
{
if (inlineShape.OLEFormat.ProgID == "Package")
{

nTotalInlineShapeCount++;
inlineShape.Select();
wordApp.Selection.Copy();

IDataObject iData = Clipboard.GetDataObject();
if (iData != null)
{
string name = iData.ToString();
string objType = "Native";
object objToSave = iData.GetData(objType);

Clipboard.SetDataObject("");
Clipboard.Clear();

MemoryStream objStream = (MemoryStream)objToSave;
long sizeOfMyObj = objStream.Length;

Kindly help me to solve the above issue.

Thanks in advance.

Viewing all articles
Browse latest Browse all 4350

Trending Articles