如何在uwp中打开office docs(word,power point,excel)。 [英] How to open office docs( word, power point, excel) in uwp.

查看:399
本文介绍了如何在uwp中打开office docs(word,power point,excel)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您想在uwp中创建doc viewer但不能获取API。甚至没有获得第三方sdk?


任何建议?




Arun Singh Rawat |流动性| UWP | WPF Skype:arun.rawat017 |电子邮件:arun.rawat017@hotmail.com | arun.rawat017@gmail.com

解决方案

嗨Arun Singh Rawat,


尝试第三个像
syncfusion
这样的派对图书馆可以完成一些任务但不是全部。


在通用Windows平台中,没有这样的API来读取/写入Microsoft文档。 


但是,您可以在其与指定文件关联的默认应用程序中打开任何文档文件。  ;使用下面的代码。

 private async void Button_Click(object sender,RoutedEventArgs e)
{
StorageFile file = null;

//要通过Picker打开文件,取消注释
// FileOpenPicker openPicker = new FileOpenPicker();
//openPicker.FileTypeFilter.Add(".docx");
// file = await openPicker.PickSingleFileAsync()

//从App的LocalFolder打开文件
var file = await ApplicationData.Current.LocalFolder.GetFileAsync(" Test。 DOCX");

if(file!= null)
{
//启动检索到的文件
等待Windows.System.Launcher.LaunchFileAsync(file);
}
}


如果它解决了你的问题,请标记为答案。


谢谢。







Hi Want to create doc viewer in uwp but not get API for it. and not even getting third party sdk?

Any Suggestion?


Arun Singh Rawat | Mobility | UWP| WPF Skype: arun.rawat017 | Email:arun.rawat017@hotmail.com| arun.rawat017@gmail.com

解决方案

Hi Arun Singh Rawat,

Try a third party library like syncfusion to do some of the tasks but not all.

In Universal Windows Platform there is no such API to read/write Microsoft documents. 

However you can open any document file in it's default app associated with the specified file. using the below code.

private async void Button_Click(object sender, RoutedEventArgs e)
{
    StorageFile file = null;

    //To Open file by Picker, Uncomment
    //FileOpenPicker openPicker = new FileOpenPicker();
    //openPicker.FileTypeFilter.Add(".docx");
    //file = await openPicker.PickSingleFileAsync()

    //To Open file from App's LocalFolder
    var file = await ApplicationData.Current.LocalFolder.GetFileAsync("Test.docx");

    if (file != null)
    {
        // Launch the retrieved file
        await Windows.System.Launcher.LaunchFileAsync(file);
    }
}

Mark as Answer if it solved your issue.

Thanks.



这篇关于如何在uwp中打开office docs(word,power point,excel)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆