none
Open Office for Android apps in edit mode from another app RRS feed

  • Question

  • Hi.

    I'm trying to edit a file from my app in Microsoft Word for Android. I've implemented my own DocumentsProvider and I'm able to open Word, browser to my provider and edit my files.

    However, if I want to open a file from my app, it always opens as read only.

    This is my code

    Uri wordUrl = Uri.parse(
    "content://my.documents.provider.authorities/document/my-file-id"
    );

    Intent wordIntent = new Intent(Intent.ACTION_VIEW);
    wordIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION);
    wordIntent.setPackage("com.microsoft.office.word");
    wordIntent.setData(wordUrl);
    startActivity(wordIntent);

    Please note that I also tried to modify the first line to

    Uri wordUrl = Uri.parse(
    "msword:ofe|u|content://my.documents.provider.authorities/document/my-file-id"
    );

    as described in https://msdn.microsoft.com/en-us/library/office/mt238280.aspx, but in this case, the file doesn't open at all (getting an error message in Word).

    Any ideas?

    Thanks!

     
    • Moved by Mattew Wu Friday, April 6, 2018 9:55 AM not dev center issue
    Wednesday, April 4, 2018 4:03 PM

Answers

All replies