//读取内容
StringBuilder sbContent = new StringBuilder();
using (StreamReader sr = new StreamReader(Application.StartupPath + "/content.txt"))
{
string line;
while ((line = sr.ReadLine()) != null)
{
//双引号开头,中间处理换行
if (line.Length > 0 && line[0] == '"')
{
string temp = line.Substring(1);
while ((line = sr.ReadLine()) != null)
{
if (line.Length > 0 && line[line.Length - 1] == '"')
{
temp += line.Substring(0, line.Length - 1);
sbContent.Append(temp + "\r\n");
break;
}
else
{
temp += line;
}
}
}
else
{
sbContent.Append(line + "\r\n");
}
}
}C# CSV文件读取(带换行单元格""中内容处理)
原创
©著作权归作者所有:来自51CTO博客作者草宝虫啊的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
table 中,如何使得单元格的内容不换行,单元格不被撑开
table-layout:fixed 阿罗裤剪短发了 阿罗裤剪短发了 阿罗裤剪短发了
table 中 如何使得单元格的内容不换行 单元格不被撑开 table-layout:fixed -
jxl 读取合并单元格中的内容
for(int k = 0;k
getmergedcells gettopleft excel getrow ws
















