3

How do I open text document, .docx and .xls document in windows phone 8, I am saving file in isolated storage then trying to open using Launcher.FileAsync but do not getting the result. For more information, see my code below:

  string file = "Download.txt";
  IsolatedStorageFileStream isfStream = new IsolatedStorageFileStream(file, FileMode.Create, IsolatedStorageFile.GetUserStoreForApplication());

        isfStream.Close();


        StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder;
        StorageFile pdffile = await local.GetFileAsync(file);

        Windows.System.Launcher.LaunchFileAsync(pdffile);
Nitesh Kothari
  • 890
  • 12
  • 27
  • 1
    check [this](http://stackoverflow.com/questions/16791369/accessing-files-from-windows-store-app). – Gowtham Oct 06 '14 at 12:58

1 Answers1

1

The syntax of GetFileAsync() is

public IAsyncOperation<StorageFile> GetFileAsync(string name)

where

name : The name (or path relative to the current folder) of the file to get.

your string is

string file = "Download.txt";

This might not be accepted as a relative path. Try something like,

string file = @"\Download.txt";
Karthik Nishanth
  • 2,000
  • 1
  • 22
  • 28
  • Karthik, I got the solutiuon, I was trying to launch before completely download it. So, it was corrupting it. I have done it using background downloader, and then launch it. Thanks – Nitesh Kothari Nov 17 '14 at 05:19