Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在C中创建excel文件的路径#_C#_Excel_Extract - Fatal编程技术网

C# 在C中创建excel文件的路径#

C# 在C中创建excel文件的路径#,c#,excel,extract,C#,Excel,Extract,我正在用C语言编程,根据搜索参数从WindowsForm中的Excel文件中提取数据。我一直在研究如何创建正确Excel文件的路径,以便从中提取数据。有什么想法吗?提前感谢要以任意路径打开文件,您需要避开反斜杠 System.IO.StreamReader reader = new System.IO.StreamReader("c:\\your\\path\\here\\file.xlsx"); 或使用@ System.IO.StreamReader reader = new System.

我正在用C语言编程,根据搜索参数从WindowsForm中的Excel文件中提取数据。我一直在研究如何创建正确Excel文件的路径,以便从中提取数据。有什么想法吗?提前感谢

要以任意路径打开文件,您需要避开反斜杠

System.IO.StreamReader reader = new System.IO.StreamReader("c:\\your\\path\\here\\file.xlsx");
或使用
@

System.IO.StreamReader reader = new System.IO.StreamReader(@"c:\your\path\here\file.xlsx");

更具体地说,创建路径的实际问题是什么?它应该像字符串连接或使用一样简单,但如果没有更多详细信息,我们无法真正回答您的问题。请显示您当前在形成路径方面的尝试。您是如何创建路径的?您是否在表单中使用OpenFileDialog?