简体   繁体   English

写入文件后打开文件

[英]Opening a file after writing to it

I have a small app that writes to an excel file. 我有一个写到excel文件的小应用程序。

I would like for the program to immediately open the file after it has finished saving it. 我希望程序在完成保存后立即打开文件。

How to go about doing just that? 怎么做呢?

Using Epplus to handle the excel. 使用Epplus处理Excel。

if u just want to open file in C# u can just import 如果您只想在C#中打开文件,则可以导入

using System.Diagnostics;

then u can run process for "xlsx" file with Process.Start(string path); 然后您可以使用Process.Start(string path);为“ xlsx”文件运行进程Process.Start(string path);

class Program
{
    static void Main()
    {
        Process.Start(@"C:\your.xlsx");
    }
}
Process process = new Process();

 process.StartInfo.FileName = "excel.exe";
 process.StartInfo.Arguments = "myfyle.xls";
 process.Start();

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

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