Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how to insert image to the Header/Footer of MS Word - using CNiWordDocument

I program my application to generate report that links to MS Word using CNiWordDocument.  I need to insert image to the header and footer (letter head and logo).  Is there any way to do so?  I know function InsertImage that just insert image to the body of the document but do not know how to insert image to header/footer.  Thanks for your help!
 
Yajai
0 Kudos
Message 1 of 2
(3,411 Views)
Hello Yajai,

I would suggest using the WordReport instrument that ships with LabWindows/CVI (<install dir>\CVI80\toolslib\activex\word\wordreport.fp).  If you open the code for the WordRpt_SetFooter fucntion, you will notice that the code shows how to insert text into a footer.  To insert a image into the footer, you should replace the call to Word_SelectionTypeText with the following lines of code:
 
// Gets a handle to the inlineshapes object
Word_GetProperty (currSelHandleL, NULL, Word_SelectionInlineShapes, CAVT_OBJHANDLE, &inlineShapes);

// Adds an image
Word_InlineShapesAddPicture (inlineShapes, NULL, "", , , , );

For more reference, I would suggest searching MSDN.  I also found the following website that demonstrated how to use VBA to insert a barcode into a Word footer.

Also, as a final note, if you have CVI questions, I would suggest posting to the CVI forums, since you increase your chances of getting another CVI customer to respond to your post.

Hope that helps.
0 Kudos
Message 2 of 2
(3,396 Views)