Word 2007 COM object

I am having a heck of a time finding a good example of a word
COM object. I just upgraded from word 2000 to word 2007, in hopes
that would suddenly work for me (which honestly I didn't
expect...). In word 2000, this line worked fine, but not in 2007:
thisDoc.SaveAs("c:\MyDoc.doc");
Here is what I am trying to accomplish: I need to use values
submitted by forms and input it into a word document. The word doc
needs to have different paragraphs in different formats. I thought
I could build the paragraphs somehow, with formatting with
something like para1 = docrange.newparagraph(); then insert the
text and formatting into para1 and then insert para1 into the
document. It does not seem to be working at all. If someone can
link me to a good example I can figure it out from there, but I
don't seem to be able to find it. Here is my code so far:
<cfquery name="getAttorney" datasource="agreement">
Select * from Attorney where ID = #Form.attorney#
</cfquery>
<cfoutput query="getAttorney">
<cfset attornyInfo =
"#Name#
#email#
#Phone#">
</cfoutput>
<CFTRY>
<!--- If it exists, connect to it --->
<CFOBJECT
ACTION="CONNECT"
CLASS="Word.Application"
NAME="objWordApp"
TYPE="COM">
<CFCATCH>
<!--- The object doesn't exist, so create it --->
<CFOBJECT
ACTION="CREATE"
CLASS="Word.Application"
NAME="objWordApp"
TYPE="COM">
</CFCATCH>
</CFTRY>
<CFSCRIPT>
/* This will open Word if running locally */
objWordApp.Visible = true;
/* This returns the 'Documents' collection the Word Object
thisDoc = objWordApp.Documents.add();
/* Save the document to a location */
thisDoc.SaveAs("c:\MyDoc.doc");
docRange = thisDoc.Range(0);
docRange.Style=-2;
docRange.InsertAfter("Header1");
docRange.InsertParagraphAfter();
docRange.Style=-3;
docRange.InsertAfter("I am the paragraph you requested");
docRange.InsertBreak();
docRange.InsertAfter("check me out... I'm on the second
page!");
para1 = thisdoc.paragraphs.count();
data = docrange.listparagraphs();
data1 = docrange;
/* Save the changes */
thisDoc.Save();
/* Close the document */
thisDoc.Close();
/* Quit Word */
objWordApp.Quit();
</CFSCRIPT>
<cfdump var="#para1#">
<cfdump var="#data#">
<cfdump var="#data1#">
The dumps do dump information on the related objects, giving
me methods, puts and gets, but I need more explantion than what is
actually provided. Para1 used to dump "1" even though I had more
paragraphs than that in the build. Since I upgraded to 2007, I have
not gotten it not to error out, I will try to save it as a docx,
but a doc is really more appropiate for my purposes.
Thank you for your time.

The last time I had to deal with a requirement like this,
which was
about 2000-2001, we eventually scrapped the word COM thing.
Even then
it was such a fragile and perilous solution, fraught with
problems and
headaches.
What we ended up doing, that was much easier, was to create a
.rtf, rich
text format, file. We could do all the required formating in
this
format, and 90% of the uses would have this file open in MS
Word and not
even know they did not get a .doc file.
How we did it was create a .rtf template with dummy text that
had all
the desired formating. Then we could read in the .rtf file,
which is
just a marked-up text file, not a binary, and string replace
the dummy
text with the dynamic text. Save it again and viola a rich
text
formated file with the required content.
These days, I would push for doing this in PDFs and use
ColdFusion's
<cfdocument...> and|or <cfpdf...> functionality.
But if it has to be
Word, I suppose it has to be Word.

Similar Messages

  • Error this object is corrupt or is no longer available while trying to open a embedded files in word 2007 or 2013

    Hi All
    Word 2007 and 2013 always show this error
    This object is corrupt or is no longer available while clicking a embedded files( like pdf, doc and xls). I tried reinstall office 2007, and office 2013. But still have same problems.
    I surf internet, find out solution like turnning  off the add-on,  but not working for me, and I do not install Norton AntiVirus.
    Does anyone know what the solution of this issue is, I do not have any idea right now.
    Thanks in advance!!!!!

    I notice there is a cross post on Answer Forum:
    http://answers.microsoft.com/en-us/office/forum/office_2013_release-word/error-the-object-is-corrupt-or-is-no-longer/fde2160e-fc19-4f90-81db-4f569fac7b95
    Is Dinel's suggestion helpful?
    Tony Chen
    TechNet Community Support

  • Adobe Acrobat v8.1.2 - PDFMaker COM Add-in not loading in Word 2007

    PDFMaker COM Add-in is now not loading in Word 2007 at startup. But, it loads just fine for the rest of the Office 2007 apps. It loaded just fine, all operational, until 1-2 months ago. Now I have no access to Acrobat in Word 2007 except for print to that printer. There are now no buttons on the ribbon for direct access to Adobe Acrobat functions as there used to be. When I look in the COM add-ins area of Word 2007, it tells me PDF Maker is not loaded and that I cannot change the connected state of Office Add-ins registered in HKEY_LOCAL_MACHINE in the Regedit.
    Am running MS Office 2007 SP-1 on Vista SP-1 x82. This behavior was going on before the recent SP-1's were installed, so pre-existing condition. Everything else is performing quite well. REALLY! I am very pleased with Vista.
    Guidance, help, etc is most appreciated. THANKS!!!

    I had the same issue. The COM Add-In for PDFMaker was disabled by Word 2007 due to an unexpected crash during the creation of a PDF. I have searched all over the place trying to find a way to get the PDFMaker functionality active again in Word 2007 including the solutions mentioned in this post. In the end I found a solution myself.
    1. Go to Word Options > Add-ins
    2. Go to the Manage drop down dialog at the bottom of the page and select Disabled Items. Click Go.
    3. A dialog will open that displays all the disabled add-ins. Select Acrobat PDFMaker Office COM Addin.
    4. Click the Enable button.
    5. Close and reopen MS Word and the Acrobat menu should be available again.

  • COM object model not functioning after encrypting the word document using office extention

         After encrypting A word document using office extention, it seems like the COM object model becomes unusable. I cannot not manipulate the encrypt document through COM interface, nor can I write macro VBScript to do some operation on the docuent.
         For example, I create a word Macro with some simple code.
    Sub hi()
        Dim i As Integer
        i = ThisDocument.Fields.Count
        MsgBox i   
    End Sub
         If the document is not encrypt, then we will see a msgbox which tells us the number of bookmarks in the current document.
         Now, encrypt the word document using the office extention, running the macro code will fail with error code " 80004005" and error message:Method 'Fields' of bject 'ThisDocument' failed.
    It is very important for us to manipulate word documents through COM interface in our system, I want to know why the COM interface does not work anymore after the document is encrypted.

    I take macro script as an example to demonstrate that word COM object model cannot be used after encripted. Actually you can reproduce the same problem when you manipulate word document through COM interface using any programming language.
    For example, you can create a text document  with the following VBscript:
    set a = createobject("Word.Application")
    set doc = a.Documents.Open("E:\temp\test.docx")
    msgbox doc.Fields.count
    doc.close
    a.quit
    Save the document with ".vbs" file extention and then run it by double clicking it. it will fail if the document is encrypted using the office extention. 

  • Making a pdf of a 19" x 13" Word 2007 object/text document

    How do I create a PDF with Acrobat 9 Pro from a 19" x 13" book cover layout made in Word 2007. When I try to create the Pdf using Adode as my printer half of 19-inch layout is cut off. Using the print method conversion settings I changed the paper size to 19" x 13"  and followed the directions in the "ADD/Modify" box but it still makes a cut off PDF. HELP!

    Have you tried just using the Save As Adobe PDF command in Word?

  • Corrupted .docx file. Word 2007. Can't open the document. Tags mismatch. Help?

    The Office Open XML file *.docx cannot be opened because there are problems with the contents.
    Details: The name at the end tag of the element must match the element type in the start tag.
    Location: Part: /word/document.xml, Line: 2, Column: 3487212
    Hmm, I guess I should give some background info and what I've tried so far, right?
    The document is in word 2007, Windows 7. Last night, I was in a hurry, and got a lot of things open. I was opening the document to do a few quick spontaneous revisions, but it was so laggy and I was late for an appointment, so I was feeling panicky
    and frustrated. In hindsight, it probably wasn't the best option to just force shut the PC down cause word stopped responding in the middle of opening the document. Still, while I'm no Sherlock, I knew stopping it while it's in the middle of saving the document
    would bebad, I didn't think stopping it while opening the document (and not really modifying the document at all, at least that was what I thought before), could have drastic consequences! The document's quite
    large, a few hundred words, and about 500 or so pages. It's this really big project I was doing at work, for months now really, and because it's somewhat business confidential in nature, I can't exactly share it freely, or I would've uploaded a copy, sorry.
    Anyway, I woke up this morning and opened it, and the error came up. By the way, the document was saved in a 2TB external hard with a few disk errors in the past, if that helps, even if I'm pretty much sure its not a problem with the hard. The error
    came up... and yeah. I first made a copy, which I've been trying everything on, in case I do end up making things worse. I have no previous versions of it, just a relatively very old backup. Anything less than 80% recovery would set me back weeks with a wage
    cut. The good news is that I was able to open the document in WordPad, managing to recover the first 287 pages (131,543 words), with no errors or data loss, and saved it in a separate file. Apparently, according to information I obtained later, MSWord tends
    to not open at all when it encounters an error, but Wordpad tends to stop reading the rest of the code once it encounters an error. So, naturally, I assumed (so correct me if I'm wrong), that behind a few sentences I might lose due to the error, the rest could
    also be salvageable. I then looked up the problem all over the internet. Read a microsoft article on troubleshooting/recovering corrupted documents (Open & Repair, Draft Mode, Creating Link, Recover text from any file converter, etc). No dice.
    I first saw a similar question on answers.microsoft, and tried to use Tony Jollan's Rebuilder, macros enabled and all. Sadly, no luck.
    I managed to make my first breakthrough when I found out that .docx was just a .zip file, and could be renamed as such, with the document.xml extracted and manually fixed using an XML editor (not that I knew how to do that, but I was desperate and
    willing to learn). So, made another copy, changed extensions, and tried to specifically extract the document.xml. I believe that it is the main body text, right? That is the only thing really necessary for me, since everything I've done so far is entirely
    spartan, with no fancy fonts, formatting, header/footer/notes, media objects, formulas, tables, bullet points, numbered lists, etc. All pure sans-serif text, with some Japanese Kanji thrown in. 500 pages of pure text.
    I then hit a snag, when WinRAR encountered an error on extracting document.xml, stating that "CRC failed in word\document.xml. The file is corrupt". So I tried to fix this using several ZIP repair programs and stuff. Nothing worked. At
    least not so far. Managed to extract an incomplete version of document.xml using WinRAR's 'Keep Broken Files' option when extracting. The extracted
    document.xml came up to 3.31 MB while the original in archive is 7.53 MB. Viewed it in the Windows XML Editor which opened up the text in Internet Explorer, a jumble of text with no line breaks or paragraphs. Still, it actually extracted a few pages less than
    the open-using-Wordpad method tried earlier. So trying to fix the archive again...
    So I decided to give up the manual route for the meantime and focus on readymade solutions. I came across yet another microsoft article, but this one was at least more relevant than the last. It had this auto FixMe thing. I ran it, didn't
    work. Apparently, as I found out later, "This fix will work for one specific tag error where there are equations and graphics in the same paragraph AND Office 2010 SP1 has not been applied."
    Tried several (read: dozens) corrupt Word recovery software, from freeware to pro trials, to varying degrees of effect, although unsuccessful
    in goal. Some failed to read it, saying it was too corrupted for them to handle, the best managed to recover about three-pages-worth less data compared to the Wordpad method. So yeah, anybody with a similar problem, always open it with wordpad first and recover
    what you can. That doesn't mean I'm giving up though.
    So here I am, tearing my hair out in frustration. Whew, I feel like I told you guys my life story. I guess worst case scenario, I report this to my boss, so I personally or from the company, I/we'll hire a team of professionals to deal with it.
    But that's not an ideal scenario. It's gonna be out of my salary either way (the company has a firm policy of 'You reap what you sow'), along with a wage cut for making such an amateurish mistake even with continuous reminders to back it up every two sentences,
    so I'd rather avoid that.
    I'm currently looking to see whether there's a way to recover a previous version of an overwritten document somehow using a third-party software or something. (I didn't have Windows Backup enabled, so no previous version on Windows). So far, no
    autosaved documents on MSWord AutoRecover, even though I have it enabled set to every 3 mins (or maybe I'm just not seeing it since I'm trying to look for it manually?). Or are the temporary files wiped on shutdown? I don't have 'Always save backup copy' option
    enabled on word either.
    So yeah, an auto fix, or a lengthy answer detailing what exactly I should do (from the very very basics), or a link to a site with such info, would be much appreciated. Seriously :D
    Please. Thanks for at least making an effort :)

    When a Word document file is corrupted, then you can try several methods to recover it:
    1. First of all, you can try the recovery function integrated with Microsoft Word, as follows:
    1) On the File menu, click Open.
    2) In the Look in list, click the drive, folder, or Internet location that contains the file that you want to open.
    3) In the folder list, locate and open the folder that contains the file.
    4) Select the file that you want to recover.
    5) Click the arrow next to the Open button, and then click Open and Repair.
    You may find more information about this at:
    http://office.microsoft.com/en-us/word-help/recover-the-text-from-a-damaged-document-HP005189610.aspx (for Word 2003)
    http://support.microsoft.com/kb/893672/en-us (for Word 2007/2010/2013)
    2. If you have multiple corrupt Word documents, then you can use the VBA macro provided in article
    http://support.microsoft.com/kb/893672/en-us so that all the files will be opened in "Open and Repair" option automatically.
    3. There are also free tools from third-parties that can open and read Microsoft Word documents, for example,
    3.1 OpenOffice at http://www.openoffice.org. This is a very famous open source project that is designed to support Office file formats, including Word documents. The software can run under Windows.
    3.2 LibreOffice at http://www.LibreOffice.org. Another free office suite.
    3.3 AbiWord at http://www.abisource.com. This is a cross-platform tool that works under Unix and Windows.
    3.4 Google Drive at https://drive.google.com/ also support to load Word document files.
    Sometimes when Word fails to open your document, these tools may be able to open it successfully. If that is the case, then after the document is opened, you can just save it as a new document which will be error-free.
    4. For docx files, they are actually a group of files compressed in Zip file format. Therefore, sometimes, if the corruption is only caused by the Zip file, then you can use Zip repair tools such as WinRAR at
    http://www.rarlab.com to repair the file, as follows:
    4.1 Assuming the corrupt document is a.docx, then you need to rename it to a.zip
    4.2 Start WinRAR, go to "Tools > Repair Archive" to repair a.zip and generated a fixed file a_fixed.zip.
    4.3 Rename a_fixed.zip back to a_fixed.doc
    4.4 Using Word to open a_fixed.doc.
    There may still be some warnings when opening the fixed file in Word, just let ignore it and Word will try to open and repair the fixed file. If the file can be opened successfully, then you can just save the contents into another error-free file.
    5. If all above methods does not work, then you may try third-party tools such as DataNumen Word Repair at
    http://www.datanumen.com/word-repair/
    I have used it to repair some word documents successfully. It provides a free demo version so that you can try to see if the data you want can be recovered or not.
    Good luck!

  • Acrobat 9 Pro - Will it print to pdf with embedded pdf's from Word 2007?

    Hello All,
    We're considering upgrading to Acrobat 9 Pro or Extended.  One of our concerns is whether it will handle the following:
    1. We create very large documents and we like the ability to use OLE of existing PDF documents imbedded into Word 2007 which causes a new PDF window  to open up from the imbedded PDF.  It also displays nicely as an icon or the cover page within Word.
    2. The challenge is when printing (distilling) that master document with any imbedded PDFs, the icon or cover page is displayed, but the OLE feature goes away and does not recognize the imbedded PDF any longer; Acrobat simply treats the imbedded PDF in Word as any other page in the distilling process.
    3. We're not wild about bookmarking or linking to another PDF.
    Does Acrobat 9 Pro or Extended resolve this issue?

    The options availible for scripted print settings are all shown in the entry for "PrintParams" object in the Acrobat JavaScript Reference.  Have you looked to see if these options fit your needs?  If they do, and if the script can detect which PDF requires which options, then  you're in business.  But if the options you need are not there, then your only option is to set the batch process to display the print dialog for every PDF.
    Thom Parker
    The source for PDF Scripting Info
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    http://www.adobe.com/devnet/acrobat/javascript.html
    Then most important JavaScript Development tool in Acrobat
    The Console Window (Video tutorial)
    The Console Window(article)

  • PDF embedded in Word 2007 won't open in final PDF

    Hello -- I've embedded a PDF into a Word 2007 doc using Insert > Object > Create from File (and displayed as an icon).  I can double-click to open the PDF while in Word, but after converting the file to PDF (using the "Create PDF" function, not printing to PDF), the "embedded" PDF is just a picture of the icon -- nothing opens.  I've used the same procedure previously and had no problem opening the embedded file, and I don't think I changed any settings anywhere...but obviously I could be wrong...  BTW, I'm using Acrobat 9 Pro.  Any ideas?  Thanks,
    JG

    Hi Steph99,
    In addition to the reply from Paul
    P Clement IV
    above, the other Microsoft areas relating to
    WORD in Office you could try asking in are;
    http://social.technet.microsoft.com/Forums/en/word/threads
    and
    http://answers.microsoft.com/en-us/office/forum/word
    Regards,
    Click this link to see the NEW way of how to insert a picture into a forum post.
    Installing VB6 on Windows 7
    App Hub for Windows Phone & XBOX 360 developers.

  • Converting a PDF to Word 2007

    I need to convert a PDF file to Word 2007 in an editable format.  Is this possible and how do I achieve it?
    I want to be able to preserve the formating as well as all the text.  I want the text to be in the same format and editable in word along with all the objects and images.

    I'm afraid this isn't a forum where we know a lot about PDFs either.  We're more about Photoshop and image editing here.  The Acrobat forum *might* be better...
    http://forums.adobe.com/community/acrobat/creating__editing_%26_exporting_pdfs?view=discus sions
    -Noel

  • How can display word 2007 document file as a read only on web browser

    hi,
    i want to display word 2007 document file as a read only that means non editable file. At present i am displaying word file by using response object. please help me.
    Thanks,
    Raj

    Hi dear,
    Try with the sample code which has given in below link....
    http://forums.devshed.com/java-help-9/need-help-reading-word-document-with-jsp-20316.html
    ---Vidya
    Message was edited by:
    ragas

  • Word 2007 and Windows 7

    When opening a document from My Documents, first I am asked if I want to give MS Word permission to make changes on my computer. Then an error message, without a code, "There is a problem sending the commandto the program." To use Word I have to start the program and then open a file. I did not have this problem with Win 7 Beta.
    I have run the troubleshooter and checked for compatability. Each time it detects a problem but no fix has worked.
    I have uninstalled Office 2007, re-installed, repaired and have installed Office SP2 and nothing has worked.
    Any ideas???

    Important This article contains information about modifying the registry. Before you modify the registry, make sure to back it up and make sure that you understand how to restore the registry if a problem occurs. For information about how to back up, restore, and edit the registry.
    SYMPTOMS
    When you use Dynamic Data Exchange (DDE) to send commands to Microsoft Office Word 2003, your custom program may not be able to come to the foreground. If you try to switch focus away from the Word 2003 window, Word 2003 will automatically come to the foreground again. You cannot switch from the Word 2003 document or minimize the Word 2003 window while the DDE commands are being sent to Word 2003.
    CAUSE
    This problem occurs because every time that Word 2003 obtains a WM_DDE_EXECUTE message from the calling program, it calls the SetForegroundWindow API to force itself into the foreground. As the DDE caller continues to automate Word 2003 through DDE, you will not be able to switch to another application because Word 2003 will come back into the foreground.
    RESOLUTION
    This problem was first fixed in a hotfix that is now contained in a service pack. If you installed the latest Office 2003 service pack, you do not have to install the hotfix.
    Service pack information
    This problem is corrected in Office 2003.
    To resolve this problem, obtain the latest service pack for Office 2003. For more information, click the following article number to view the article in the Microsoft Knowledge Base:
    After you install the service pack, follow the steps that are listed in the "More Information" section to set the DontJumpForegroundInDDEExec registry key and to enable the hotfix.
    Hotfix information
    How to obtain the hotfix
    This issue is fixed in the Word 2003 Hotfix.For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
    Description of the Word 2003 post-Service Pack 1 hotfix package
    After you install this hotfix, follow the steps that are listed in the "More Information" section to set the DontJumpForegroundInDDEExec registry key and to enable the hotfix.
    STATUS
    Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section. This problem was first corrected in Office 2003 Service Pack 2.
    MORE INFORMATION
    Warning If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.
    To activate this hotfix, follow these steps:
    1.
    Quit Word 2003.
    2.
    Click Start, and then click Run.
    3.
    In the Open box, type regedit , and then click OK.
    4.
    Locate and then click to select the following registry key:
    HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Word\Options
    5.
    After you select the key that is specified in step 4, point to New on the Edit menu, and then click DWORD.
    6.
    Type DontJumpForegroundInDDEExec, and then press ENTER.
    7.
    Right-click DontJumpForegroundInDDEExec, and then click Modify.
    8.
    In the Value data box, type 1 , and then click OK.
    9.
    On the File menu, click Exit to quit Registry Editor.
    Issues that this fix With package fixes
    This hotfix fixes the following issues that are not previously documented in a Microsoft Knowledge Base article:
    When you try to open a Word 2007 document that has nested XML tags applied to the Word document's content, you may receive the following error message:
    XML has been disabled in the document as the system has become unstable. Close all programs and restart your computer
    In Word 2007, you open a document in a shared network location. Then, you use the Send to Exchange Folder command to send a copy of the document to an Exchange folder. However, when you view the document in the Exchange folder, you see that the document has a Temporary Internet file name instead of the document's original file name.
    Consider the following scenario:
    You save a Word Macro-Enabled Template (*.dotm) file in one of the following STARTUP folders:
    Drive :\Users\ user name \AppData\Roaming\Microsoft\Word\STARTUP
    Drive :\Program Files\Microsoft Office\Office12\STARTUP
    You start an instance of Word 2007.
    When you run the winword.exe /automation command to start a second instance of Word 2007, you may receive the following error message:
    File In Use
    file name is locked for editing by ' user name '. Do you want to:
    Open a Read Only Copy
    Create a local copy and merge your changes later
    Receive notification when the original copy is available
    Note In the error message, file name is the name of the Word Macro-Enabled Template (*.dotm) file that you saved in the STARTUP folder. BUG #:
    MORE INFORMATION
    Hotfix information
    A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem. This hotfix might receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next software update that contains this hotfix.
    If the hotfix is available for download, there is a "Hotfix download available" section at the top of this Knowledge Base article. If this section does not appear, contact Microsoft Customer Service and Support to obtain the hotfix.
    Note The "Hotfix download available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.
    Prerequisites
    There are no prerequisites for installing this hotfix.
    Restart information
    You do not have to restart the computer after you apply this hotfix.
    Hot fix replacement information
    This hot fix does not replace a previously released hot fix.
    Registry information
    You do not have to make any changes to the registry to apply this hot fix.
    This hotfix is scheduled to be included with 2007 Microsoft Office Suite Service Pack 2.
    NOTE - Disclaimer
    By using the following materials or sample code you agree to be bound by the license terms below and the Microsoft Partner Program Agreement the terms of which are incorporated herein by this reference. These license terms are an agreement between Microsoft Corporation (or, if applicable based on where you are located, on of its affiliates) and you. Any materials (other than sample code) we provide to you are for your internal use only. Any sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. We grant you a nonexclusive, royalty-free right to use and modify the sample code and to reproduce and distribute the object code form of the sample code, provided that you agree: (i) to not use Microsoft's name, logo, or trademarks to market your software produced in which the sample code is embedded; (ii) to include a valid copyright notice on your software product in which the sample code is embedded; (iii) to provide on behalf of and for the benefit of your subcontractors a disclaimer of warranties, exclusion of liability for indirect and consequential damages and a responsible limitation of liability; and (iv) to indemnify, hold harmless, and defend Microsoft, its affiliates and suppliers from and against any third party claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of the sample code.

  • 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.

  • Word 2007: Error when saving file that contains equations

    Using Microsoft Word 2007, version 12.0.6425.1000 with Service Pack 2
    I am a High School Math teacher, and when working on a document that contains a number of math equations. When I try to save the document, Word refuses to save. It displays the following error: "A file error has occurred. <filename>. OK",
    and I am unable to save the file. 
    Reading the forum, I have found this to be a very common issue going back to 2009, but I have not seen a definitive solution or patch. 
    I have found a workaround:
    Creat a new document
    Copy and paste from the corrupted doc each page, saving the new document after each page
    Until I hit the error, then I know the page that has the issue, and can usually narrow it down to a specific math equation. Nothing fancy just some basic math. 
    Manually rewrite the equation in the new document and it will successfully save.
    But the issue has been occurring more and more frequently now and it is becoming very frustrating. Any help would be greatly appreciated! 

    There has been a long time known issue with the equation editor.  it causes document corruption by "losing" XML tags.
    Apparently fixes for some causes of these problems have been rolled out in Windows updates. But the problem still exists.  You've got it easy. A lot of people running into this problem are students working on documents, like a thesis, that is on a short
    deadline ...
    One identified cause of these problems is editing equations
    after you created them.  DON'T DO THAT! 
    If you have to change an existing equation, create a new correct one and delete the old one.
    Simpler fix. Don't use Word (or Office) for creating equations.  Find some other product, like a pencil.
    Over in the "Answers" forum there are a couple volunteers, Tony Jollans and Jeeped
    , who have been manually fixing this type of error if you post a new question or add a reply to one of the ongoing discussions on this issue.
    Sorry.
    If you want to invest the time to figure out what your error looks like you may be able to come up with a fix other than copy /paste method.
    Can't open Word File because of end tag/start tag mismatch error... XML Tag 
    - XML Error – Fix It tool - “The name in the end tag of the element must match the element type in the start tag”
    This error is caused when Word either “forgets” to write an XML tag, or writes them in the wrong order.
    Tony Jolans was the first person that I heard of with home made tool to fix the problem. Now MS has released a Fix It for one specific variation of the problem.
    If the tools don’t fix your problem, the file will have to be fixed manually, repairing the tag order.
    The Fix It article notes that the document is still in a fragile state. You have to do some addition fixing to avoid repeats of the problem.
    https://blogs.technet.com/b/wordonenotesupport/archive/2011/03/24/error-when-opening-a-word-2007-or-2010-document.aspx
    http://support.microsoft.com/kb/2528942- FIX IT
    This fix it will work for one specific tag error where there are equations and graphics in the same paragraph AND Office 2010 SP1 has not been applied.
    Preventative suggestions
    <snip Jeeped>
    I don't think that anyone can completely stop editing equations, but pre-planning them should avoid unnecessary edits.
    While I have no concrete, reproducible evidence that editing equations is a cause, I have made these empirical observations:
    I cannot state precisely what many of the DOCX XML tags do, but basic XML syntax rules would suggest that code like:                   <m:oMath><m:e><m:ctrlPr/></m:e></m:oMath>
    ... does nothing at all since it closes everything it opens and offers no content. It looks to me that this is a result of deleting one or more characters from an equation.
    While Word 2010 reports these as a problem at:                  Line: 2  Column: 0 ... Word 2007 will still report the actual position, e.g.:                
     Line: 2  Column: 2726981 I keep a copy of Word 2007 side-by-side Word 2010 for no other purpose. It's the only Office 2007 program on my computer. This seems like it is actually a step backwards from a resolution since Word 2010 no longer seems
    to be able to parse its own error.
    Whether the syntax is truly useless and non-effective for any intent or purpose is actually beside the point. The syntax passes conformity tests and the DOCX
    should launch. Why an 85 page document is 'broken' due to a few empty XML formatting tags while retaining legal syntax structure is beyond me.
    I try to pass along the area that the problem was in and several times people have remarked that the area I report was the place they were last making modifications/deletions to equations (not additions) when the no-load corruption
    occurred.
    When no indication from the OP is offered on what was worked on last, the Line: 2 Column: 0 corruption often comes within a formula at the very end of the unfinished Word/Document.xml file and it may be inferred
    that this was the last place being worked upon.
    The corrupt DOCX files I've worked on are very commonly at the last stages of development with a large complex document. While there couldn't be a worse time for a corruption to appear, it would seem that small edits to existing content are causing
    it and not large scale new content generation.
    Not one of these points is a definitive 'smoking gun', but put together they seem to indicate
    formula editing and not formula writing as a cause for the Line: 2 Column: 0 corruption. If it looks like a duck and quacks like a duck, it is most often a duck.
    </snip>
    Copy “True Autosave Macros for Office” to this place in reply
    Let me fix it myself
    If you are familiar with editing XML, you can try to fix the problem yourself by correcting the sequence of the mismatched oMath tags in the document. See the following example:
    Incorrect tags:
    <mc:AlternateContent>
    <mc:Choice Requires=”wps”>
    <m:oMath>
    </mc:AlternateContent>
    </m:oMath>
    Correct tags:
    <m:oMath>
    <mc:AlternateContent>
    <mc:Choice Requires=”wps”>
    </mc:AlternateContent>
    </m:oMath>
    Note: You will have to use an application such as Notepad to edit the XML.
    Manual Technique
    <snip>  A DOCX document is actually a .ZIP file that contains many internal components. There is an internal folder called word which will always contain a document.xml file. This file is the basis of the document's layout
    and content.
    Assuming that the DOCX archive structure has not been corrupted, it can be opened in an archive utility. I use
    WinRAR for this. Once opened in
    WinRAR, you can drill down into the
    word folder and see the document.xml file. I use
    Notepad++ as a text editing tool and have the .xml file extension associated with this program so i can simply double-click
    document.xml in WinRAR to open an editing session.
    Notepad++ has cursor positioning in the right-hand side of the status bar and finding the position of the error (supplied by a failed open in Word) is pretty straightforward. I look for empty formatting
    tags first and only remove content if removing empty tags does not allow the document to be opened. I try to note existing content in the area that I make modifications in order that I can supply position reference information to the owner of the DOCX.
    When editing, I assume the philosophy that kess is more. My target is to get the document to open in Word with as little modification as possible and let the original owner of the DOCX make any necessary adjustments.
    I should mention that after making a change to word/document.xml you need to save it in
    Notepad++ then go to
    WinRAR and acknowledge that you want to update the file in the DOCX archive. Once the archive is updated, you can attempt to open the DOCX in Word to see if your efforts are successful.
    WinRAR                    
    Notepad++                 
    </snip>
    Further Fixes
    The Fix it solution in this article should let you recover your Word document. However, the symptoms will reappear when you make any further edits to the document unless the core problem in the structure of the document is resolved.
    To try to correct the core problem, follow one of these workarounds:
    Install Office 2010 Service Pack 1
    Office 2010 Service Pack 1 resolves this issue for new files. It will also prevent the problem from recurring with any files that were recovered with the Fix it solution in this article.
    To download Office 2010 Service Pack 1, follow the steps provided in this Microsoft knowledge base article:
    2460049 - Description of Office 2010 SP1
    Grouping Objects
    The steps provided work best under Word 2010:
    After you open the recovered document, turn on the Selection pane. This can be found in the
    Home tab of the ribbon. The editing group of the
    Home tab has a dropdown button named Select.
    Click the Select button, and then click
    Selection Pane...
    Press the Ctrl button on your keyboard and then click each text box in the selection pane.
    Click the Group button under the Format tab. This will group all the objects together.
    As soon as you have all objects grouped on each page, save the document under a new name.
    Save the document in the .RTF file format
    The steps provided work for both Word 2007 and Word 2010:
    After you open the recovered document, click File and select
    Save (for Word 2007 click the Office button and select
    Save As)
    In the Save As dialog box, click "Save as type:" dropdown and select
    Rich Text format (*.rtf).
    Click Save.
    Click to view this
    blog for more information about this issue.
    Bonus tip: Win7 Win8 Math Equation Input Panel / Math input Panel
    http://www.lytebyte.com/2009/07/24/guide-to-math-input-panel-in-windows-7/
    http://www.7tutorials.com/windows-7s-tablet-input-panel-text-entry-and-handwriting-recognition
    http://www.7tutorials.com/training-tablet-input-panel-work-even-better
    http://www.7tutorials.com/do-math-easy-way-math-input-panel
    Not an answer to the problem, just a bonus that may make it easier to input formula’s in Win7.
    Here’s another one of those didn’t-know-it-existed-until-I-clicked-it-by-accident tools in Win7. It’s called the
    Math Input Panel.
    To access it, simply click Start, and in the Search Box that appears above, type in
    Math Input Panel.
    The Window should look like this:
    Let the fine folks at Microsoft explain what it’s used for:
    “Math Input Panel uses the math recognizer that’s built into Win7 to recognize handwritten math expressions. You can then insert the recognized math into a word-processing or computational program. “
    Tony Jolan’s Automatic Fix
    Download  http://www.wordarticles.com/temp/Rebuilder.dotm Microsoft Office Word Macro-Enabled Template (.dotm) and open it.
    Click Options button on the Security warning and select Enable this content.       
    Click the Broken Documents tab at the far right of the ribbon.      
    Click the Rebuild button in the left-hand side      
    Locate and open your corrupt document in the file open dialog.
    That's it. The process will repair your document if possible and create a new document with (Rebuilt)
    appended to the filename. Be patient as it may take a few minutes. If a repair is not possible, you can then post to a public file area and someone here can attempt a manual repair.
    Manual Fix
    XML Maker V1.1 is free. It will allow you to open the document.xml file and edit it. It also marks errors and warnings. 
    I just didn’t have much luck working with it.
    A poster used XML Maker V2.1 (US$125, 30day free trial, enough for average person to fix a file)
    Notepad ++ is a good, free editor for this type of task
    Make a copy of the file
    Rename the copy from DOCX to ZIP
    Open … .ZIP/word/document.xml in notepad
    Copy the contents of the file to clipboard
    Open Word
    Paste a copy of the copied XML into Word
    (optional) the XML is one long string too hard to read, you can replace some tags, with that tag plus a para mark to break up the text to make it more people readable.
    Open an XML validator, ie this site on the internet:
    http://www.w3schools.com/xml/xml_validator.asp
    Paste another copy of the XML into the “Syntax Check Your XML” input window
    Click on “validate” button
    Copy the missing tag, ie </mc:Fallback>  (yours will be different)
    Return to word Find: mc:Fallback>  (without the </ so you find both open and closing tags). 
    Repeat find until you hit 2 open tags in a row.  Then you just have to figure out where to put the closing tag between them. 
    Look for other tags before and after a proper closing tag so you can match the problem area to a good area.
    Discussion by many affected people, a couple in discussions are also fixing problem if Tony’s fix doesn’t work
    http://social.answers.microsoft.com/Forums/en-US/wordcreate/thread/581159d0-9ebc-4522-b30c-53e33e8268e1
    Document Recovery
    http://www.wordarticles.com/Shorts/Corruption/Formats.php
    This page has the most readable description of Word file structures, DOC and DOCX, I have seen so far
    The logical structure of a Word 97‑2003 format document is one of a series of elements arranged in a hierarchy, much like a mini file system. As an example, here is the structure of a simple Word 97‑2003 (.doc) format document:
    MyDocument.doc
    1Table
    *CompObj
    Word Document
    *SummaryInformation
    *DocumentSummaryInformation
    The physical structure of the complete file bears little relation to the logical structure; it is, again, of a proprietary design, a compound, or structured storage, file. Briefly, and loosely, the separate logical elements of the file are broken up into
    blocks; these blocks are treated as individual units, which units are then organised without regard for their logical arrangement, and catalogued, catalogue and organisation detail being held alongside the blocks themselves, to enable recombination into logical
    components when necessary.
    Just to give you a flavour, here are some views of three small parts of such a document, viewed in a hex editor:
    Views of a Word 97-2003 format Document
    The logical structure of a Word 2007 format document is one of a series of elements arranged in a hierarchy, much like a mini file system. As an example, here is the structure of a simple Word 2007 (.docx) format:
    MyDocument.docx
    _rels
    rels
    docProps
    app.xml
    core.xml
    word
    _rels
    document.xml.rels
    theme
    theme1.xml
    document.xml
    settings.xml
    fontTable.xml
    webSettings.xml
    styles.xml
    [Content_Types].xml
    As briefly as before, the [Content_Types] file and the _rels folders, along with the subordinate files therein, contain information about the logical structure, and the two files in the docProps folder contain much the same as the two Information files
    in the old format. The document.xml element within the word folder holds the bulk of the document content and the other files within that same folder hold formatting details.
    So, you might say, the internal structure of a document has changed a little, so what? There are, however, other changes that make a bigger difference. The first is that, although both logical formats are conceptually similar, they are wrapped up in
    completely different ways to make a single file. Instead of the proprietary physical structure used for Word 97‑2003 format documents, a fairly standard, and open, Zip Archive format is used for Word 2007 format documents. The second change is that instead
    of using obscure binary codes, everything in Word 2007 format documents, well almost everything, is held in XML format.
    All data held as XML? In a standard Zip Package? It should be much easier to work with, then? Judge for yourself; here are some views of parts of a Word 2007 format document taken from a hex editor:
    Views of a Word 2007 format Document
    FreeFileViewer – reads 100+ text, Office, audio, video format file types – Can open some XML tag error files
    http://www.freefileviewer.com/formats.html
    Can't open Word file due to undeclared prefix, Location: Part: /word/document.xml, Line:91, Column: 49921
    The most likely cause of your particular problem is that you are missing a
    schema prefix reference within the opening <document ...> XML tag (usually the second one). Different
    schema references are required for various types of specialty content. Here is a sample opening <document ...> tag with a large number of various schema prefix codes. If I remove one or two of these, i can reproduce
    your error message.
    <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
    xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
    It's impossible to blindly say exactly what you are missing but if you post an unadulterated copy of your document to a public file area (as noted above) and post the location back here, someone may be able to help. If you are going to go this route, send
    a copy that has not already been subjected to repair attempts.
    FWIW, while it may be hard to determine exactly which schema you may be missing, I do not believe that having extras causes any problems.
    BTW, you don't actually have to rename the DOCX file extension if you have an archiving program. I use WinRAR and simply
    <right-click>, Open With... to expose the archive.

  • Error message: Missing PDF maker files in Word 2007

    OK, I am beyond frustrated. I have had nothing but trouble with Windows Vista and Adobe Acrobat. Please help!!!
    What happens: first, the pdf addin for Word 2007 suddenly becomes disabled, for no apparent reason. Forget about trying to re-enable it through the Add-Ins menu, because Word tells me that the "connected state of Office Add-Ins registered in the HKEY_LOCAL_MACHINE cannot be changed". This is a problem for me, because I use a special font (Vietnamese) that sometimes gets corrupted when running pdf maker. The only consistent way I have found to avoid this problem is to run the pdf maker as "Quick PDF" and as far as I can see that option is only available through the pdf addin in Word, I have never been able to find it when I open the Acrobat program and create a pdf from there.
    Second problem: shortly after the pdf addin becomes disabled, my Acrobat program loses the ability to create pdfs altogether. I get the error message "Missing PDF maker files". Yes, I have tried repairing the installation and re-starting my computer per the instructions given. It doesn't fix the problem. I also tried looking in the Knowledge Database on this website, but it appears that the instructions they have to fix the problem there are for earlier versions of Word, not 2007, because my version of word does not look like the version of Word in their little videos.
    This is the second time this has happened. The first time I resolved the problem by a) re-installing Acrobat, which is a pain because it involves calling Adobe and wading through their customer service to get a new installation number, and b) paying a computer repair service to dig deep into the guts of my computer and convince it to change the Office Add-ins to allow the pdf addin again. It worked for about 6 months, and now I have the same problem again. For some reason Vista is spontaneously disabling Acrobat.
    I simply cannot deal with this every few months. We all know that Vista is a crappy program, but I run a business and I need a program that works with whatever crappy program Microsoft puts out. Please, can anyone give me suggestions about how to re-enable these functions when Vista disables them?
    Thanks in advance!
    Alycia

    for Office 2007, see if this Microsoft product will work for you
    http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87 041&displaylang=en

  • How Can I Print 2 Pages per Sheet with Bookmarks in Word 2007?

    Is there any workaround to print 2 pages per sheet (in MS Word) with bookmarks?
    I always get the following message:
    Acrobat PDFMaker has detected that 'Multiple Pages option in Page Setup' has been selected. It will not be able to create tags, links, bookmarks with this option selected...
    --Roborabbit

    The Word 2007 pdf export (the one MS has here: http://www.microsoft.com/downloads/details.aspx?FamilyID=f1fc413c-6d89-4f15-991b-63b07ba5f 2e5&displaylang=en) supports bookmarks right?

Maybe you are looking for

  • MSS General Information (Employee Search iview Fetching wrong Manager)

    Hi, In MSS we have General Information page which has Employee Search iview. This iview display the information in a table which has several columns... (Name, Personal Number, Manager, Position, Staffing Ration, Job... etc) The problem is under the M

  • Hyperion Shared Services inatllation problem

    Hi, I have installed the Hyperion Shared serives 9.3.1 with Oracle Application server and configuration but in services.msc i am able to see only HyperionS9OpenLDAp. i did the all post task and did manual configuration for Oracle Application Server l

  • Reflect on a Function object?

    I'm trying to discover information about a Function object at runtime. Specifically, I'd like to know the number and types of parameters the Function expects. Calling flash.utils.describeType() on my Function object doesn't give me this information.

  • Want to do mass processing for inspection lots with status SPRQ

    Hello, My company using early lot creation for 04 inspection type. We have thousands of inspection lots with status "UD   ICCO SPRQ PRII PRSI STUP". Now due to SPRQ status, system is not closing process orders associated with thousands of inspection

  • Problem with starting iPhoto!

    I open it up, and it just keeps loading and won't let me do anything... Just loads.