• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C#导出TXT

原作者: [db:作者] 来自: [db:来源] 收藏 邀请
public static void ExportTxt(string[] fileContent)
        {
            System.Windows.Forms.SaveFileDialog objSave = new System.Windows.Forms.SaveFileDialog();
            objSave.Filter = "(*.txt)|*.txt|" + "(*.*)|*.*";

            // objSave.FileName = "CallHistory.txt";
            string[] nuclide = { "H3""H4""H5" };
            string[] km = { "N""NNE""NE""ENE""E""ESE""SE""SSE""S""SSW""SW""WSW""W""WNW""NW""NNW" };
            if (objSave.ShowDialog() == DialogResult.OK)
            {

                using (StreamWriter objWriter = new StreamWriter(objSave.FileName, false, System.Text.Encoding.UTF8))
                {
                    foreach (string str in nuclide)
                    {
                        objWriter.WriteLine("核素:" + str);
                        objWriter.WriteLine("每个扇区的年平均大气弥散因子(S/M**3)".PadLeft(56));
                        objWriter.WriteLine("".PadRight(114'-'));
                        objWriter.WriteLine("  KM   0.25-1     1-  2    2-  3    3-  5    5- 10   10- 20   20- 30   30- 40   40- 50   50- 60   60- 70   70- 80 ");
                        objWriter.WriteLine("".PadRight(114'-'));
                        for (int i = 0; i < km.Length; i++)
                        {
                            TaoCalculate.Model.CalculateModel model = new Model.CalculateModel(fileContent[i]);
                            objWriter.WriteLine(km[i].PadLeft(6) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9));
                        }
                        objWriter.WriteLine();

                        objWriter.WriteLine("每个扇区的相对地面沉积因子(1/m**2)".PadLeft(56));
                        objWriter.WriteLine("".PadRight(114'-'));
                        objWriter.WriteLine("  KM   0.25-1     1-  2    2-  3    3-  5    5- 10   10- 20   20- 30   30- 40   40- 50   50- 60   60- 70   70- 80 ");
                        objWriter.WriteLine("".PadRight(114'-'));
                        for (int i = 0; i < km.Length; i++)
                        {
                            TaoCalculate.Model.CalculateModel model = new Model.CalculateModel(fileContent[i]);
                            objWriter.WriteLine(km[i].PadLeft(6) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) +
                                ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9) + ScienceCount.KXJSF(model.Wind1.Deviation).PadLeft(9));
                        }
                        objWriter.WriteLine();
                        objWriter.WriteLine("".PadRight(114'-')); objWriter.WriteLine("".PadRight(114'-'));
                    }

                    Process.Start(objSave.FileName);
                }
            }
        }

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
复习前面一个月的学习C#感觉道路好艰难啊发布时间:2022-07-13
下一篇:
C#调用AXISWebServices发布时间:2022-07-13
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap