I also needed to add a few lines to get the watermark sized properly within the page as shown below in vb.net: Public Shared Function AddWatermark(strType As String) As Booleanĭim app As Application = ĭim doc As Document = ĭim missingValue As Object = Missing.Value Typing is extremely laggy now when the image is inserted. Thanks so much for your assistance! This worked perfectly! Except that is slows Word down to a crawl. This is often an indication that other memory is corrupt.ĭoes anyone have any ideas? Again, this works in Word 2010 perfectly? If Mid(hdft.Shapes(j).Name, 1, 20) = "WordPictureWatermark" Thenīut it get hung up on ".shapes(j).delete()" with the following error:Īttempted to read or write protected memory. Then, when the button is pressed again, it is suppose to remove the image using this code: For i = 1 To įor Each hdft As Word.HeaderFooter In oDoc.Sections(i).Headers However, the second press of the button, it will insert the image successfully and not produce the error. The first time I click the button to insert the watermark which uses this code: For Each section As Word.Section In oDoc.Sectionsĭim nshape As Word.Shape = section.Headers().Shapes.AddPicture(strWatermarkFile, True, True)Įrror HRESULT E_FAIL has been returned from a call to a COM component. When the button is clicked again, it removes the watermark image. The addin adds a watermark image to the first page of the document. However, when using with 2007 it does not. I have developed an addin that works perfectly in Word 2010. Thanks for helping make community forums a great place. We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time.
![word to pdf microsoft 2007 plugin word to pdf microsoft 2007 plugin](https://chi2014.acm.org/img/accessibility/tags-1.png)
![word to pdf microsoft 2007 plugin word to pdf microsoft 2007 plugin](https://secure.rackham.umich.edu/images/pdf_conversion/3.png)
#WORD TO PDF MICROSOFT 2007 PLUGIN HOW TO#
It's in C#, if you want VB.NET code, just use some tools to translate it, or translate it by youself.įor how to delete the watermark, take a look at this thread: Shape.Top = Convert.ToSingle(WdShapePosition.wdShapeCenter) Īpp. = WdSeekView.wdSeekMainDocument Īpp. = .WdViewType.wdPrintView Shape.Left = Convert.ToSingle(WdShapePosition.wdShapeLeft) Shape shape = (watermarkPath, ref linkToFile, ref saveWithDocument, ref headerfooterRange).ConvertToShape() Object headerfooterRange = headerFooter.Range watermarkShape.Top = Convert.ToSingle(WdShapePosition.wdShapeCenter)
![word to pdf microsoft 2007 plugin word to pdf microsoft 2007 plugin](https://images.wondershare.com/pdfelement/how-to/save-word-to-pdf.jpg)
ref refmissing, ref refmissing, ref refmissing) ref linkToFile, ref saveWithDocument, ref refmissing, ref refmissing, WdHeaderFooterIndex hfIndex = WdHeaderFooterIndex.wdHeaderFooterPrimary įor (int i = 1 i < + 1 i++) String watermarkPath = linkToFile = false
#WORD TO PDF MICROSOFT 2007 PLUGIN CODE#
To add watermark picture into the Word2007 document, you can check this code snippet, it works fine for me: private void btnAddWartermark_Click(object sender, RibbonControlEventArgs e)Īpplication app = ĭocument doc =