[英]How to add local file link to Exported CSV file using C#
I want to add the link to my local file into one of the columns of Exported CSV file.So that when user clicks on the link the local file open.我想将本地文件的链接添加到导出的 CSV 文件的列之一中。这样当用户点击链接时,本地文件就会打开。 I have searched the internet for this but can't find any good solution.
我已经在互联网上搜索过这个,但找不到任何好的解决方案。
Here is the screenshot of what i try to do -这是我尝试做的截图 -
Suppose when user clicks on File path selected row file full name then upon click i should open the file at that localtion.假设当用户单击 File path selected row 文件全名时,我应该在该位置打开文件。
My code to generate the CSV file is-我生成 CSV 文件的代码是-
public void GetExportDetailsCSV(ExportInformation ExportInfo)
{
StringBuilder cameraRows = new StringBuilder();
string filePath = ExportInfo.ExportOutputPathAtClient + SLASH_STRING + "ExportDetails.csv";
string columnsNames = "File Name ,File Path" + "\r\n";
if(Directory.Exists(ExportInfo.ExportOutputPathAtClient))
{
try
{
foreach (string newPath in Directory.GetFiles(string.Format("{0}{1}", ExportInfo.ExportOutputPathAtClient, SLASH_STRING), "*" + ExportInfo.VideoFileFormat.ToString(), SearchOption.AllDirectories))
{
FileInfo FileDetails = new FileInfo(newPath);
cameraRows.Append(string.Format("{0},{1}\r\n", FileDetails.Name, FileDetails.FullName));
}
string FinalData = "\nExport Remarks : Simple Export " + "\n\n" + "," + "," + "," + "," + "File Details" + "," + "\r\n" + "\r\n" + columnsNames + "\n " + cameraRows;
using (var stream = System.IO.File.CreateText(filePath))
{
stream.WriteLine(FinalData);
}
}
catch(Exception ex)
{
}
}
}
My question is simple how can i put file location value as a link in my Exported CSV file.我的问题很简单,如何将文件位置值作为链接放入导出的 CSV 文件中。 Thankyou!
谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.