Attached Word Document Problem

satish_navsatish_nav Member Posts: 65
Hi Experts..

I was added Attachment functionality for my purchase Order. By this functionality i can create,Open,Import,Export or Remove an MS Word document for an Purchase Order. This Functionality is working well
but the problem is MS Word document is Created in MS Wod 2003 Version, but my client is using MS Word 2007. When client want to import an document which is in MS Word 2007 its imported but when open the Document thrown the following Error.


C?SIDE Hyperlinking failed.
You tried to hyperlink to this target.
C:\DOCUME~1\ADMINI~1\LOCALS~1\TEMP\Doc2.DOCX
Do you want to Place that hyperlink target on the clipboard?

For this Functionality i used Following Objects.

Table ---> Attachment(5062)
Code Unit -- > WordManagement(5054)
Code Unit ---> AttachmentManagement(5052)

Can any one help me on this ....Plz..
Thanks in advance..

Satish...

Comments

  • matttraxmatttrax Member Posts: 2,309
    Does that file exist in EXACTLY that path and with EXACTLY that name and extension? Hyperlink just opens the parameter you pass to it with the associated extension on the machine.

    On an unrelated note, consider storing your attachments in a file share. All a user has to do is clear their temp files and you've lost the attachments they did...or so it looks based upon the path in your post.
  • satish_navsatish_nav Member Posts: 65
    No not Exactly. I was Imported the document from my desktop. When i followed the path what the error shown, there is a no word document with extension .docx

    Is it requires any changes in the objects what is used for this functionality with extension .docx.

    Please suggest me...
    Thanks in advance..

    Satish...
  • matttraxmatttrax Member Posts: 2,309
    satish_nav wrote:
    No not Exactly. I was Imported the document from my desktop. When i followed the path what the error shown, there is a no word document with extension .docx

    If that exact file is not there of course the OS won't know what to open. Is the file there with just a .doc extension instead? Or is nothing there at all resembling what you want to open?

    Also I am confused...are you trying to open a document in Word 2003 that was created in 2007? Or is it the other way around?

    2007 can open old versions of word documents. 2003 can open 2007 documents if you download the converter from Microsoft. You can also save document into a 2003 format from 2007.
  • mabl4367mabl4367 Member Posts: 143
    I have the same problem. It works as long as the document is saved in the older .doc format. If the document is saved in .docx format i get the same kind of error.

    I belive that the path in the error message is where a temp copy of the document is stored while the user is editing it. I think that the problem is in one of the codeunits that is used. I think that the code in those objects were written before the conseption of the .docx format and that the code assume that the file suffix is .doc.

    Have you or anyone else found a solution to this problem yet?
  • mabl4367mabl4367 Member Posts: 143
    Hello everyone!

    I think i have a solution to this problem :)

    I made some changes in the folowing objects:
    Type ID Name
    1 5062 Attachment
    5 5052 AttachmentManagement
    5 5054 WordManagement

    In these objects the file extension for microsoft word documents is hard coded. This can cause problems because if the attachment is stored as a blob in the database it is first copied to a temporary file before it is opened. If the attachment is in docx-format the temp file will still have the .doc extension. When word tries to open the file it gets confused.

    Replace all checks like:
    IF UPPERCASE(FileExtension)<>'DOC' THEN with
    IF NOT UPPERCASE(FileExtension) IN THEN

    Make sure that all functions that assume the extension is .doc get the correct extension as a parameter or get it from a record in the attachment table. An example of this is the function "ConstDocFilename" in cu5054 WordManagement that creates a name for the temporary file.

    After these modifications everything worked in my case.
Sign In or Register to comment.