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

ConvertToShape return null

$
0
0

hello

    I want to insert a picture into word document and  Converts it to a free-floating shape , The method of ConvertToShape return NULL pointer of shapeptr. But the picture has been converted into free-floating shape. Because the pointer is null , so I can't do anything with the free-floating shape! the folowing is my source code , is any problem with my source code? thanks !!

 Word::SelectionPtr spSelection = m_pApp->Selection;
 Word::InlineShapesPtr spInlineShapes = spSelection->InlineShapes;
 Word::InlineShapePtr spInlineShape;
 COleVariant vtTrue((short)VARIANT_TRUE);
 COleVariant vtFalse((short)VARIANT_FALSE);
 spInlineShape = spInlineShapes->AddPicture(_bstr_t(lpPicFile), vtFalse, vtTrue);
 if (NULL != spInlineShape) {
  ShapePtr shape = spInlineShape->ConvertToShape();
  if (shape != NULL) {
      shape->ZOrder(msoSendBehindText);
  }
 }


Viewing all articles
Browse latest Browse all 4350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>