4

Here is the intent I use to open a word file:

Intent intent = new Intent();
intent.setAction(Intent.ACTION_EDIT);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(fileUri, MimeTypeMap.getSingleton().getFileExtensionFromUrl(fileUri));
intent.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
mContext.startActivity(intent);

I feth the fileUri using this line:

FileProvider.getUriForFile(context, "my authority", file);

File is opened correctly in both Microsoft word app and OfficeSuite app, but in both apps, the file is in read only mode and I cannot edit the file directly. When I open that word file with a file manager app like ES File Explorer, the file is in read write mode and edit is enabled.

I tried both ACTION_VIEW and ACTION_EDIT and the same happened.

Misagh Emamverdi
  • 3,654
  • 5
  • 33
  • 57
  • 1
    Install an intent intercept app on your device to see how your intent differs from that of ES File Explorer. (Assuming that ES does not open the file itself but invokes an external app). – greenapps Aug 23 '18 at 13:39
  • @greenapps, It seems that the problem is MS Word app. It works correctly with `file://` schema, and it has problem with `content://`. ES File Explorer always works with `file://`. – Misagh Emamverdi Aug 26 '18 at 05:06
  • so could you fix this problem and open a word file and edit it? I have a similiar question https://stackoverflow.com/questions/56287019/word-document-is-always-read-only-when-opened-with-intent – Aiko West May 27 '19 at 11:57
  • Just wrote a technical documentation what I still found out: https://github.com/cryptomator/cryptomator-android/issues/150#issuecomment-514401775 Microsoft has to fix this problem as soon as possible! – Jules Jul 23 '19 at 22:13

0 Answers0