help needed VC++ with MS Word
-
I am in the mist of editing a legacy program which output the report to words format. I am require to add in images, but I am unable to set the position of the images. I am able to add the images but all at (0,0) range. i'm using the following codes _Document oDoc; Shapes oShape; oShape = oDoc.GetShapes(); oShape.AddPicture // v is suppose to be the indicator of the top and left points tagVARIANT v; v.lVal = v.intVal = v.iVal = v.fltVal = 200; ("C:\\Logo.JPG",vtFalse,vtTrue,&v,&v,vtOptional,vtOptional,vtOptional); the image still appear at point (0,0) Is it correct to use Shapes class or should I use InlineShapes :confused: can someone please advise me... where have I gone wrong :confused: Thomas
-
I am in the mist of editing a legacy program which output the report to words format. I am require to add in images, but I am unable to set the position of the images. I am able to add the images but all at (0,0) range. i'm using the following codes _Document oDoc; Shapes oShape; oShape = oDoc.GetShapes(); oShape.AddPicture // v is suppose to be the indicator of the top and left points tagVARIANT v; v.lVal = v.intVal = v.iVal = v.fltVal = 200; ("C:\\Logo.JPG",vtFalse,vtTrue,&v,&v,vtOptional,vtOptional,vtOptional); the image still appear at point (0,0) Is it correct to use Shapes class or should I use InlineShapes :confused: can someone please advise me... where have I gone wrong :confused: Thomas
Barm wrote: tagVARIANT v; v.lVal = v.intVal = v.iVal = v.fltVal = 200; tagVariant is an
union
. That means alllVal
,intVal
,iVal
, etc. share the same space, so assigning multiple fields makes no sense. You should assign only one of the value fields, and set thevt
member to indicate which is the one you are using. As you didn't initializevt
, it must have remained as zero, which indicates an empty variant (i.e.:v.vt == VT_EMPTY
), and that may be why the image remains at 0,0 Try the following:tagVariant v;
v.vt = VT_I4;
v.lVal = 200;-- jlr http://jlamas.blogspot.com/[^]
-
Barm wrote: tagVARIANT v; v.lVal = v.intVal = v.iVal = v.fltVal = 200; tagVariant is an
union
. That means alllVal
,intVal
,iVal
, etc. share the same space, so assigning multiple fields makes no sense. You should assign only one of the value fields, and set thevt
member to indicate which is the one you are using. As you didn't initializevt
, it must have remained as zero, which indicates an empty variant (i.e.:v.vt == VT_EMPTY
), and that may be why the image remains at 0,0 Try the following:tagVariant v;
v.vt = VT_I4;
v.lVal = 200;-- jlr http://jlamas.blogspot.com/[^]
-
Barm wrote: tagVARIANT v; v.lVal = v.intVal = v.iVal = v.fltVal = 200; tagVariant is an
union
. That means alllVal
,intVal
,iVal
, etc. share the same space, so assigning multiple fields makes no sense. You should assign only one of the value fields, and set thevt
member to indicate which is the one you are using. As you didn't initializevt
, it must have remained as zero, which indicates an empty variant (i.e.:v.vt == VT_EMPTY
), and that may be why the image remains at 0,0 Try the following:tagVariant v;
v.vt = VT_I4;
v.lVal = 200;-- jlr http://jlamas.blogspot.com/[^]
problem for position solved but I encounter another problem, i need to put the images into different cells in a table and some images are to be outside the table. The codes is able to work but all the images are inserted into the first cell in the first table. Is there a way to set the position with respect to the a cell? Thomas