简体   繁体   English

如何在Windows Phone 8中打开.txt和.docx和.xls文档

[英]How to open .txt and .docx and .xls document in windows phone 8

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. 如何在Windows Phone 8中打开文本文档,.docx和.xls文档,我将文件保存在独立存储中,然后尝试使用Launcher.FileAsync打开,但是没有得到结果。 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);

The syntax of GetFileAsync() is GetFileAsync()的语法是

public IAsyncOperation<StorageFile> GetFileAsync(string name)

where 哪里

name : The name (or path relative to the current folder) of the file to get. name :要获取的文件的名称(或对于当前文件夹的路径)。

your string is 你的字符串是

string file = "Download.txt";

This might not be accepted as a relative path. 这可能不被接受为相对路径。 Try something like, 试试像,

string file = @"\Download.txt";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM