1

I am having a similar problem to MicrosoftOfficeEditDocument didn't work in Chrome.

I did download the updated library as said in the answer and it works fine with Office 2013 but not with 2010. With Office 2010, I have some files that open and some that don't, they are not always the same ones. I tried with .doc, .docx, .ppt, .pptx, .xls and .xlsx.

I call the edit document fonction with : ITHit.WebDAV.Client.DocManager.EditDocument(sDocumentUrl, javaAppletFilePath);

EDIT :

It actually seems to be a problem of length of file url. When my file url (sDocumentUrl) is longer than the length of my script url in which I call EditDocument it works perfectly fine. But when it is shorter, the end of the script url is added after sDocumentUrl which makes the call fail. And this only happens with Chrome and Office 2010.

Any way to make this work ?

Community
  • 1
  • 1
cilmela
  • 47
  • 7
  • Does this occur consistently for you? It works sometimes for me, but other times it doesn't work. Sometimes if I change one character in the string file URL it works. – kavun Jun 24 '14 at 19:43
  • No it isn't consistent. When I posted the question it didn't work often and one file could be open at a time and after couldn't. Right now it seems to work almost all the time except for .pptx which doesn't always open. – cilmela Jun 25 '14 at 07:46
  • It seems to work fine if I first open the file in IE and then in Chrome. – cilmela Jun 25 '14 at 07:53
  • What do you mean by, "the end of the script url is added after sDocumentUrl"? – kavun Jul 02 '14 at 17:59
  • If I call my script : "http://ipaddress:port/myscript.php" and my document Url is "http://ipaddress/shorter.doc" ItHit tries to open "http://ipaddress/shorter.docpt.php" – cilmela Jul 03 '14 at 06:45
  • Wow that's weird. Does that still happen when you add `'\0'` to the end of the document URL? – kavun Jul 03 '14 at 15:14
  • With '\0' and MicrosoftOfficeEditDocument it works fine ! – cilmela Jul 03 '14 at 15:46

1 Answers1

0

Add '\0' to the end of the URL

Add a '\0' (null) to the end of the string you are passing to MicrosoftOfficeEditDocument(). Like MicrosoftOfficeEditDocument(path + '\0');. Also, you should use MicrosoftOfficeEditDocument() instead of EditDocument() because EditDocument() will try to call JavaEditDocument() because of the null terminated string.

This is a solution taken from here - https://code.google.com/p/chromium/issues/detail?id=269183#c5

For more info - opening webdav files in Chrome via the Office Authorization plug-in for NPAPI browsers fails for certain files

Check for ActiveX first

However, you should not add the '\0' to the path when MicrosoftOfficeEditDocument() will open the document via the SharePoint.OpenDocument ActiveX object or else the ActiveX plugin will not recognize the file format via extension and try to open the document via undefined:ofe|u| instead of ms-word:ofe|u| for example. To do this you should check for ActiveX before appending the '\0'.

if (!('ActiveXObject' in window)) {
    path = path + '\0';
}

ITHit.WebDAV.Client.DocManager.MicrosoftOfficeEditDocument(path)

Warning: this solution breaks MicrosoftOfficeEditDocument in Firefox. Firefox does not like the \0 terminated string.

Community
  • 1
  • 1
kavun
  • 3,358
  • 3
  • 25
  • 45
  • Unfortunately I can't test this because I'm also using sabredav and it breaks everything when I add a '\0' into the URL of the document. But thanks for the solution anyway. – cilmela Jul 02 '14 at 12:18
  • But does adding `'\0'` to the path when calling `DocManager.MicrosoftOfficeEditDocument(path + '\0');` make the document open consistently (even if your WebDAV implementation fails because of it)? – kavun Jul 02 '14 at 12:37
  • This solution has been working for me. Hopefully you would just have to modify your WebDAV server to handle the null terminated string. – kavun Jul 02 '14 at 12:44
  • Yes it works fine with MicrosoftOfficeEditDocument but I think I have found the actual problem, it isn't random as I first thought (see my edit) – cilmela Jul 02 '14 at 14:01