一、Excel
1、DataSet到Excel的文件读写
https://www.cnblogs.com/liyunworld/p/11168153.html
2、DataTable与Excel的文件读写
https://www.cnblogs.com/wofeiliangren/p/13612573.html
3、(NPOI方式)Excel读写
(1)
https://my.oschina.net/u/4399215/blog/3435686
https://blog.csdn.net/jkhmf/article/details/82946965
(2)利用NPOI在同一个Excel文件中创建多个sheet
https://www.cnblogs.com/dyllove98/archive/2013/08/06/3241515.html
4、设置EXCEL单元格
(1)数字格式
https://blog.csdn.net/xxs77ch/article/details/50237017
https://bbs.csdn.net/topics/390938286
(2)背景填充色
https://bbs.csdn.net/topics/390203526
5、WinForm使用Aspose.Cells.dll 导出导入Excel/Doc 完整实例教程
https://www.cnblogs.com/robinli/p/3453660.html
6、大数据导出到Excel
(1)大量数据导出到Excel
https://www.cnblogs.com/xiaoheihei/p/8315856.html
(2).NET下,实现大txt文件读取并写入excel大文件
https://blog.csdn.net/golduty2/article/details/89473030
二、ini文件
1、ini文件创建、读写
https://www.cnblogs.com/xmy-007/p/6400221.html
三、txt文本
1、实现大数据量txt文本数据快速高效去重
https://blog.csdn.net/weixin_33739523/article/details/85588860
https://bbs.csdn.net/topics/392285856?page=2
四、生成pdf
1、iTextSharp 向pdf插入图片
https://blog.csdn.net/weixin_41529093/article/details/104978740
2、生成pdf文件流
https://www.cnblogs.com/albertay/p/6606305.html
五、xml
读xml注释:https://www.cnblogs.com/langhua/p/4211669.html
六、任意类型文件读写
https://blog.csdn.net/qq_21381465/article/details/80016740
string sAllTVData = ""; //要写入文件里的内容变量 FileStream fs = new FileStream("D://tempdata.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); //创建文件对象 StreamReader reader = new StreamReader(fs, System.Text.Encoding.UTF8); //创建文件读取流对象 string s_TVinfo = ""; while ((s_TVinfo = reader.ReadLine()) != null) //实际工作中对写入文件的内容处理,我遇到的是把文件里的内容读出来,然后结合当前手里的数据进行分析处理,然后重新写入文件里,当然不需要这种需求,就只单纯打开文件,写入文件就行了 { //sAllTVData = sAllTVData + s_TVinfo +" "; //sTVDataSum++; } string data = "sn=" + _uScanCode + "&workOrderCode=" + sWorkOrderCode + "&lanMac=" + _sRecieveLanMac + "&wifiMac=" + _sRecieveWifiMac + "&btMac=" + _sRecieveBtMac + "&testUserName=" + sTestUser + "&testDateTime=" + sTimeStr; sAllTVData = data; StreamWriter writer = new StreamWriter(fs, System.Text.Encoding.UTF8); //创建写入文件流对象,指定文件对象和编码字符集 writer.Write(sAllTVData); //将内容写入文件,默认是覆盖 writer.Write(System.Environment.NewLine); //给写入文件内容后添加换行 //关闭所有打开的文件流对象 writer.Close(); reader.Close(); fs.Close();
或:
public void TestWrite() { string FileName = AppDomain.CurrentDomain.SetupInformation.ApplicationBase + "\" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".data"; FileStream DataFile = File.Open(FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); int num = 1000; byte[] writebuff = new byte[num]; for (int h = 0; h < num; h++) { writebuff[h] = (byte)(h + 1); } DataFile.Seek(DataFile.Length, SeekOrigin.Begin); DataFile.Write(writebuff, 0, num); DataFile.Flush(); } public string TestLoad(string path) { int length = 0; string str = ""; try { FileStream fs = File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite); length = (int)fs.Length; byte[] readbuf = new byte[length]; fs.Seek(0, SeekOrigin.Begin); fs.Read(readbuf, 0, length); for (int i = 0; i < length; i++) { str += readbuf[i].ToString() + " "; } fs.Close(); return str; } catch { return null; } }