Word 2007 Addin to add Watermark image saved as .doc file

I currently have an addin that was developed to work in both Word 2007 and Word 2010 with the assumption the addin would be used on .docx files.  However, it is now required to also work on .doc files but still with Word 2007 and Word 2010.  Although
the following code works in both versions of Word, it will only work on .docx files and not .doc files.  On the line:
Dim shape As Shape = doc.InlineShapes.AddPicture(strWatermarkFile, linkToFile, saveWithDocument, headerfooterRange).ConvertToShape()
I get the Error
HRESULT E_FAIL has been returned from a call to a COM component.
My code that works in
2007 on .docx files and not .doc files is:
Public Shared Function AddWaterMark2007(strWatermarkFile As String)
Dim app As Application = Globals.ThisAddIn.Application
Dim doc As Document = Globals.ThisAddIn.Application.ActiveDocument
Dim headerFooter As HeaderFooter
Dim hfIndex As WdHeaderFooterIndex = WdHeaderFooterIndex.wdHeaderFooterFirstPage ' WdHeaderFooterIndex.wdHeaderFooterPrimary
Dim linkToFile As Object = False
Dim saveWithDocument As Object = True
If doc.Sections(1).Headers IsNot Nothing Then
headerFooter = doc.Sections(1).Headers(hfIndex)
ElseIf doc.Sections(1).Footers IsNot Nothing Then
headerFooter = doc.Sections(1).Footers(hfIndex)
Else
headerFooter = Nothing
End If
If headerFooter IsNot Nothing Then
Dim headerfooterRange As Object = headerFooter.Range
Dim shape As Shape = doc.InlineShapes.AddPicture(strWatermarkFile, linkToFile, saveWithDocument, headerfooterRange).ConvertToShape()
shape.LockAspectRatio = Microsoft.Office.Core.MsoTriState.msoTrue
shape.WrapFormat.AllowOverlap = -1
shape.RelativeHorizontalPosition = WdRelativeHorizontalPosition.wdRelativeHorizontalPositionMargin
shape.Left = WdShapePosition.wdShapeCenter
shape.ScaleHeight(1, Microsoft.Office.Core.MsoTriState.msoTrue)
shape.RelativeVerticalPosition = WdRelativeVerticalPosition.wdRelativeVerticalPositionMargin
shape.Top = WdShapePosition.wdShapeCenter
shape.ScaleWidth(1, Microsoft.Office.Core.MsoTriState.msoTrue)
shape.Name = "WordPictureWatermark"
doc.Sections(1).PageSetup.DifferentFirstPageHeaderFooter = True
End If
app.ActiveWindow.View.SeekView = WdSeekView.wdSeekMainDocument
app.ActiveWindow.ActivePane.View.Type = Microsoft.Office.Interop.Word.WdViewType.wdPrintView
End Function
Thanks in advance for any suggestions!

Hi Voyagr,
I also could reproduce this issue too.
Since the issue is complex, I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.
Sorry for any inconvenience and have a nice day!
Regards & Fei
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. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Word 2007 crashes during autosave and when saving as .DOC

    Hi,
    I have a problem with Microsoft Word 2007. It crashes every time during autosave. It also crashes when I try to save a file as .DOC (even an empty new file). When I save it as any other file type it's fine. 
    I have already tried repairing the office installation, reinstalling the whole suite (and then installing SP3 and all latest patches again), auto fix it from
    http://support.microsoft.com/kb/822005/en-us and
    http://support.microsoft.com/kb/921541/en-us, changing the autosave file location, using different windows account. None of these helped. I wouldn't like to work with autosave switched off.
    I am using Windows 7 Professional SP1 and Office 2007 Professional 12.0.6683.5002 with SP3 on HP EliteBook 8470w.
    -- Igor M.

    Hi,
    I tried to start Word in safe mode be it did not change anything. I also tried to start Windows 7 in clean boot but it did not help either (same issues).
    Two entries are added to the event log when Word crashes:
    First one:
    ID: 0, Application Name: Microsoft Office Word, Application Version: 12.0.6683.5002, Microsoft Office Version: 12.0.6612.1000. This session lasted 94 seconds with 0 seconds of active time.  This session ended with a crash.
    Second one (Google translation):
    Log Name : Application
    Source: Application Error
    Date: 2013-12-29 0:38:43
    Event ID : 1000
    Task Category : (100)
    Level: Errors
    Keywords: Classic
    User : Not applicable
    Computer: XXX
    Description:
    Name of the application causing the error: WINWORD.EXE , version : 12.0.6683.5002 , time stamp : 0x520bb457
    Name of the module causing the error : wwlib.dll , version : 12.0.6683.5002 , time stamp : 0x520bb54c
    Exception code : 0xc0000005
    Fault offset : 0x0006d564
    The process ID causing the error : 0xbb0
    Time to run the application causing the error: 0x01cf0425b9f67b73
    The application path causing the error: C : \ Program Files (x86 ) \ Microsoft Office \ Office12 \ WINWORD.EXE
    The path of the module causing the error : C : \ Program Files (x86 ) \ Microsoft Office \ Office12 \ wwlib.dll
    Report ID : 2fcdf5c7 - 7019 - 11e3 - 96f9 - 1c3e84fe29b2
    Event Xml :
      "><Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
        "><Provider Name="Application Error" />
        1000</EventID>"><EventID Qualifiers="0"> 1000 < / EventID >
        100</Task>"><Task> 100 < / Task >
        "><TimeCreated SystemTime="2013-12-28T23:38:43.000000000Z" />
        Application</Channel>"><channel> Application < / Channel >
        "><Security />
      "><EventData>
        12.0.6683.5002</Data>"><Data> 12.0.6683.5002 < / Data>
        wwlib.dll</Data>"><Data> Wwlib.dll < / date >
        520bb54c</Data>"><Data> 520bb54c < / date >
        0006d564</Data>"><Data> 0006d564 < / Data>
        01cf0425b9f67b73</Data>"><Data> 01cf0425b9f67b73 < / date >
        C:\Program
    Files (x86)\Microsoft Office\Office12\wwlib.dll</Data>"><Date> C : \ Program Files (x86 ) \ Microsoft Office \ Office12 \ wwlib.dll < / date >
      ">< / EventData >
    <span title="">< / Event >
    Kind regards,

  • Office 365 installed, can't choose Word 2007 as the default program for docx and doc files

    I have a client who just installed Office 365 on his Windows 7 PC. He still has Office 2007 installed. He's struggling with the changes in Word 2013 and wants me to uninstall Office 365. I thought I'd just set the default program association for .docx and
    .doc programs to Word 2007 but that doesn't seem possible. I can choose Default Programs, Associate a file type etc., and find the .docx extension. The current default is Word (desktop). I highlight the .docx extension and choose Change Program. The older
    version of Word isn't listed so I click Browse and find Program Files\Microsoft Office\Office12\winword.exe. Click OK, OK, OK, etc, but .docx files still open in Word 2013. The Default Program applet evidently sees all versions of Word as the same and refuses
    to change the association. How do I accomplish this ridiculously simple task?

    Fixed. Used a great little app from NirSoft called
    FileTypesMan. The built-in Windows utilities are getting worse by leaps and bounds.

  • Word 2007 AddIn Cannot Run on Windows XP SP3 + Office 2007

    Hi All,
    I faced an issue regarding our Word 2007 AddIn cannot run on Office 2007 + WinXP SP3.
    I developed a Word 2007 AddIn using VS 2010. The addin works fine on Win7 + Office 2007. But It cannot run in Word 2007 in WinXP.
    I have tried the following testing.
    1. I rebuild a new WinXP environment + Office 2007 + VS 2010. No antivirus in my machine. I create the Word 2007 AddIn using VS 2010. But unfortunately, it cannot run in my WinXP machine. it's very strange.
    2. I rebuild a new Win7 environment + Office 2007 + VS 2010. No antivirus in my machine, and the same steps with previous. it runs fine.
    3. I noticed that, if I debug the Word AddIn Project using VS 2010 In XP, it cannot run into debug mode. I checked the Word Options
    I have highlight the test addins it always uncheck. If I checked it, when I reopen Word. it will change to uncheck status. 
    And the addins always in Inactive Application Addin group.
    @All guys, How to solve this issue? It's very very strange. 
    Thanks a lot for your help.
    Regards,

    Hello Ricky,
    First of all, I'd suggest checking the Trust Center settings in Outlook. Then take a look at the Disabled Items list. Is your add-in listed there?
    Microsoft Office applications can disable add-ins that behave unexpectedly. If an application does not load your add-in when you try to debug it, the application might have hard disabled or soft disabled your add-in.
    Hard disabling can occur when an add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the Startup event
    handler in your add-in is executing.
    Soft disabling can occur when an add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable an add-in if it throws an unhandled exception while the Startup event
    handler is executing.
    When you re-enable a soft-disabled add-in, the application immediately attempts to load the add-in. If the problem that initially caused the application to soft disable the add-in has not been fixed, the application will soft disable the add-in
    again.
    You can read more about that in the
    How to: Re-enable an Add-in That Has Been Disabled article in MSDN.

  • I am trying to make a signature in MS Word (2007) which includes a jpg image, but when I save it as a HTML file and attach it the text appers OK but the image doesn't. I have tried various formats but still no luck. Can anyone help?

    I am trying to make a signature in MS Word (2007) which includes a jpg image, but when I save it as a HTML file and attach it the text appers OK but the image doesn't. I have tried various formats but still no luck. Can anyone help? edit

    C'mon! Anyone???? I'm desperate!

  • How To "Dis-Embed" An Image From A .Doc File?

    Here's what I've got. I'm working on a flier to be commercially printed; it contains four photos and text. I've spent a lot of time with each photo, massaging each in PE to maximize its quality when it's eventually printed, and saved each as a TIFF file. (I "tested" each photo's printability by seeing what I get when I run it through my own Canon printer.)
    What I did next was to take each of the PE processed photos, moved them into a MS Word text document, and saved the final flier results as a .doc file.
    Now, my commercial print shop tells me that better results might be obtained by me giving them the original photos instead of using the completed .doc flier. This is where my problem arises: it's not that I saved too few, I saved too many versions of the photos as works in progress. It's not an easy job to find the exact photo version I, finally, embedded. Using the "direct" approach doesn't seem to work. When I drag a photo out of its .doc file onto my desktop and try to open this clipping (PICT) with PE I get the message, "Could not complete your request because an unexpected end-of-file was encountered."
    So, how do I "dis-embed" each of these photos from the original document and without losing all the nice stuff I did when first processing them? Any comments and suggestions will be appreciated.
    Dave

    Hi,
    You can use javax.swing.ImageIcon like so
    ImageIcon anIcon=new ImageIcon("image.jpg");Hope thats what you are after,
    Cheers
    Jack573

  • Mac can't display some images from Windows .doc files.

    I've opened .doc files written in Windows Word in Pages 2009, Mac Word 2008 and Mac Word 2011 and they all fail to show some of the images within these documents. When I open these files in Windows Word, they show up just fine. Why aren't the Macs showing them properly?

    Try downloading OpenOffice or LibreOffice and opening them in one of those. They do a better job of importing Word documents than Pages. Once you've got them open, you can save them as RTF and load them into Pages. Pages is nicer to work with, but OO/LO (basically the same application) has better features.

  • Viewing and saving XLS/DOC files on iPhone?

    Is there a good program that will let me save and view XLS or DOC files on my iPhone? I have an XLS file I'd like to edit on my iPhone, and so far I've been using Google Docs, which isn't the greatest site on the iPhone. Free programs are preferred, as I've heard that Air Sharing is one of the better pay options.

    Documents Free is a free one... gets some not so good ratings... but hey its free you can delete it if its no good
    i have used documents to go on other smartphones and they always tend to work great... the one on app store is only 4.99 while i had to pay 39.99 for my palm version back when looks like the iphone one only does word... hmm maybee thats why its 4.99 not as full featured as the old ones.
    guess you could upload it to google docs and view/edit them via the browser.

  • Read image saved in binary file in Matlab

    Hello,
    I save images in binary file, in one file can be thousands of images, and I would like to read it in Matlab or in some other software.
    So I would like to know if it's posssible and if so I would like to know what exactly I save, when I save image, and how image structure look like.
    Thanks Eva

    Hi Eva,
    I have little knowledge of IMAQ, so I don't know your data type... sorry.
    But in general you read the data in MatLAB. You save the image (only 1) 100 times in the same file. Each image is prepended by a I32 with the total byte count of the image. So that is one pointer for you.
    What you could do is convert your IMAQ image into a LV picture control (this must be possible) and then convert it into a U32 2D-dbl and read this with Matlab.
    Success Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • Why won't copy/paste images appear in PDF (from Word 2007)?

    I find all places in a Word 2007 document where content copied from Power Point 2007 and then pasted into a Word 2007 document does not appear in the subsequent PDF file I generate. White space of the same size as the pasted content appears in its place. Why is this happening and are there any suggestions to work around this issue? What is curious is the free PDF creation tool that you can use to generate a PDF within Word 2007 (by choosing file save-as PDF) does NOT have this same issue. I don't want to use Word's tool since it doesn't allow for the option settings flexibility I need to produce the final PDF.
    I already tried saving the Word file as XML and then re-saving as Word .docx and regenerating the PDF from Acrobat: the graphics are still missing. I also tried in Acrobat Help> Repair Installation and then shut down/restarted my computer. Again, the regenerated PDF is missing the graphics.
    Personally, I do not use a copy/paste method; rather, I use insert>picture>from file or paste special as a grphic file type. I know the same graphics placed this way come out fine in a PDF I generate from Acrobat. However, I support a bunch of engineers who make copy/paste a shortcut habit. I will have no luck telling them not to do this.
    I appreciate any help with this.

    Preferences in Acrobat reader under Page Display are already set to Show Large Images. I assume that is the setting you mentioned.
    I don't know of any setting in Word 2007 that would make a difference. Does anyone else have work around suggestions?

  • Graphic produced in Word 2007 corrupted in Reader 9 but OK in Reader 8

    I have printed a document in Word 2007 containing an embedded Visio diagram (insert object from file)..
    In Reader 9 the picture is corrupted though it is OK in Reader 8. It is as though the picture is marked out in rectangles and the corners of the rectangles shaded in.
    I have tried with an embedded picture and the result is the same. I have also tried with Word 2010 and it is the same too.
    I even tried a freeware PDF printer driver instead of 'Save As' from Word, and the image is OK in both Reader 8 and Reader 9.
    I really need to use Word standard facilities! Can anyone help?

    I even tried a freeware PDF printer driver instead of 'Save As' from
    Word, and the image is OK in both Reader 8 and Reader
    9.
    Looks like a problem of Microsoft.

  • Word 2007 published as pdf opens by default in Photoshop

    I'm running XP SP2. When I "Save As" a Word 2007 document as "PDF", and then click "Publish", (the file name has an extension of .pdf, and the file type is .pdf), Photoshop opens automatically. What I want to have happen is for the the .pdf document I have created to automatically open in Acrobat Reader, in .pdf format.
    I also note that I do have a .pdf printer installed when I go to print from Word.
    The Adobe products I have installed are Distiller 4.0 (Acrobat 4.0), and Acrobat Reader 8.1.2. Also, Pagemaker 7.0.2 and Photoshop 6.0.1.
    I am totally befuddled.

    It is likely that you have file associations messed up in Windows. If you double click a PDF in Explorer, does the file open in Reader or Photoshop? If the latter, you need to fix the file associations. Keep in mind that saving as a PDF from WORD is not the same as creating a PDF using Acrobat (which apparently do not have). For questions about Reader, you should go to the Reader forum in the future. Maybe my guess has answered your current problem.

  • Updating '08 file adds theme images

    I noticed after saving a minor text change in an older Keynote '08 presentation file as a Keynote '09 file (no choice), the result is much larger. The original file was 260KB. The '09 file is 3.6MB. Checking the '09 file's package contents, I noticed there is a new "theme-files" folder that is 3.5MB. It holds 20 JPG images that represent all the '09 themes. I didn't use any theme for the original file, unless plain white is a theme. Either way, I don't need the other 19 theme JPGs, do I? How can I change the settings of Keynote '09 so it will not add theme images to an '08 file when updating changes?

    No, that doesn't work. That page of preferences all applies only to new documents. I am looking for a way to edit an '08 document and then save it as an '09 document without adding the useless theme images. Anyone know how to accomplish this?

  • Import Word 2007 Form check boxes undefined

    Any one have any idea on how to get the forms wizard to import the field property names for check boxes in an Adobe form?
    I have a Word 2007 form which I have tried saving as a .doc, .dot, dotm, .docx and no matter what format I choose, I cannot get the check box fields to import.  I used the legacy checkbox field under the developer ribbon in Word 2007 to create the check boxes.   I have tried to import with protection on the word form enabled and stopped but it doesn't make a difference. The check box fields come across fine but the name and the text fields both say undefined rather then display the field name given in Word.  I am using Adobe 9 pro.  I have checked my Adobe preferences in Word and made sure all the boxes were checked for converting bookmarks but it still did not make a difference.  The text fields are importing fine with the property field names.
    Here is an example:
    I have a yes check box that is labeled StorageY and a no checkbox labeled StorageN for the properties in Word.  I then went to the form wizard in Adobe 9 and selected start with existing form and selected the fillable word form I created with the check boxes.  I imported it and the check box properties say Undefined for both storageY and storageN.   There are about 60 check boxes in the document and I don't want to retype them every time in Adobe when the word form is updated and has to be conveted again.
    I sure hope there is a solution.
    Thanks.

    Thanks for the information but I respectfully disagree with "there is no import".  If you open Adobe Acrobat
    9 pro and go to Forms, Start Forms Wizard, select An Existing electronic document and click on Next. Select "import" a file from file system and browse for the word document and click on Next.
    Using this method not only runs the automatic field recognition you were referring to, it also brings in all the word form field text and formats with the exception of the check boxes.  My only guess is the problem has something to do specifically with the check box fields as it does bring over the radio button text.  A lot less work to keep the form updated.  It rocks.  You should try it some time.
    Word 2007 pdf writer does the same thing as the openoffice.org but neither bring across the form field info.  They just create a starting point and you would have to use the method you described above to create the fillable form.

  • Pages document saved as doc not readable by word

    Hi all,
    Lately I'm having trouble exporting my Pages documents to Microsoft Word format. I've tried the "Export" option directly available in the File menu, as well as the "Save as a copy" option in the Save dialog box. De document is correctly saved as .doc file and Pages can open, read and modify it, but I'm unable to open the exported document in Microsoft Word on my Windows PC. LibreOffice on my Linux PC does open the file, but doesn't show any of the content. Only some strange symbols are shown.
    I'm running Mac OSX Mountain Lion with Pages downloaded from the App Store, so everything is up to date.
    Does anyone have the same problem or know how to solve it?
    Thanks in advance!

    Since it's obviously not a Pages plist issue, I think more drastic measures are called for.
    The simplest would be to run the Mountain Lion 10.8.3 combo updater. In systems past, running the combo updater, even if it had been used before, can clear up some system odditites. It may work, but I think the problem is with Pages. Again, the simplest approach would be to delete Pages & reinstall it and run Software Update. I know you should get the most recent version from the Mac App Store, but this has helped others in the past.  The files to delete are the iWork ’09 folder from the main HD > Applications; the iWork ’09 folder in HD > Library > Application Support & the individual iWork application plist files found in HD > Users > (your account) > Library > Preferences for each user. The easist way to delete iWork '09 is to use Yvan Koenig's AppleScript that removes the files. You can find it on his box.com account in for_iWork'09 > other_iWork'09 items > uninstall iWork '09.zip.

Maybe you are looking for

  • Accessing ABAP Functions in Web Dynpro Java

    Hi, I am trynig to do "Accessing ABAP Functions in Web Dynpro Java" this application, (which is the example application which i got from www.sdn.sap.com) but everything is fine no error also while dyploying. But it is not dysplaying the first page af

  • Google playstore no connection and wifi connection is ok

    Suddenly the connection to the Google Play Store ist not working but my wifi connection is ok. Any recommendations? Please help me...;-)

  • Date range in report output

    Hi Abaper, I have a requirment to display range of date in report output . I have fixed output to 7 days. when ever i input date range 7 days its display fine but when i input 3 days the report output date is display upto 3 is fine but in 5th to 7th

  • Selling the Kinect v2 as part of a robotics product

    Hi, I am part of a robotics startup that is interested in using the Kinect v2 as core part of my product Are there any commercial re-sale restrictions regarding the Kinect v2? Could I purchase the sensor and re-sale as part of my product? Please let

  • How can i get starting offset of logical drives?

    I want to use so recomended Storage Management API Classes, but i can't find way to retrive starting offset of the logical drive