var template = @" BEGIN:VCARD VERSION:2.1 N;CHARSET=gb2312:;{0};;; FN;CHARSET=gb2312:{0} TEL;CELL:{1} EMAIL;WORK:{2} ADR;WORK;CHARSET=gb2312:;;{3};;;{6}; ORG;CHARSET=gb2312:{4} TITLE;CHARSET=gb2312:{5} END:VCARD "; StringBuilder sb = new StringBuilder(); foreach(var item in items)//items能够直接从Excel复制过来 { var i = item.Split('\t'); sb.AppendFormat(template, "姓名", "1390000", "13@qq.com", "地址", "公司", "职务", "310001"); } File.WriteAllText("电子通信录.vcf", sb.ToString(),Encoding.Default);
其实没什么好说的,关键点就是gb2312 和 Encoding.Defaultui