C# 在现代Windows应用程序(Metro)中,打开应用程序中包含的excel文件

C# 在现代Windows应用程序(Metro)中,打开应用程序中包含的excel文件,c#,xaml,windows-store-apps,C#,Xaml,Windows Store Apps,因此,我尝试创建一个应用程序,其中我在应用程序本身中有一个excel文件,然后在用户按下按钮时在excel中打开它。我对这方面还不太熟悉,所以我不太确定该怎么办。我已经做了以下工作: string fileToLaunch = @"Assets\SOF.xltx"; private async void LaunchFileButton_Click(object sender, RoutedEventArgs e) { var file = await Windows.

因此,我尝试创建一个应用程序,其中我在应用程序本身中有一个excel文件,然后在用户按下按钮时在excel中打开它。我对这方面还不太熟悉,所以我不太确定该怎么办。我已经做了以下工作:

string fileToLaunch = @"Assets\SOF.xltx";
private async void LaunchFileButton_Click(object sender, RoutedEventArgs e)
    {

        var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(fileToLaunch);

        bool success = await Windows.System.Launcher.LaunchFileAsync(file);

    }

它给我的是一个文件未找到错误。如果我对png文件使用相同的命令,效果很好。有什么想法吗?

可能是文件的扩展名有误。通常Excel文件以“.xlsx”结尾,这是一个Excel模板文件