2014-07-18 85 views
3

如何在Windows Phone 8中打开文本文档,.docx和.xls文档我将文件保存在隔离存储中,然后尝试打开使用Launcher.FileAsync但没有得到结果。欲了解更多信息,请参阅我的代码如下:如何在Windows Phone 8中打开.txt和.docx和.xls文档

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); 
+1

检查[this](http://stackoverflow.com/questions/16791369/accessing-files-from-windows-store-app)。 – Gowtham

回答

1

GetFileAsync()语法

public IAsyncOperation<StorageFile> GetFileAsync(string name) 

其中

:名称(或路径相对到当前文件夹)的文件得到。

您的字符串是

string file = "Download.txt"; 

这可能不被接受为相对路径。尝试类似,

string file = @"\Download.txt"; 
+0

Karthik,我得到了解决方案,我试图在完全下载之前启动。所以,它正在腐蚀它。我已经使用后台下载程序完成了,然后启动它。谢谢 –

+0

祝你好运@Nitesh! –

+0

谢谢@Karthik –

相关问题