• 输出txt文本


    SaveFileDialog sfd = new SaveFileDialog();
    sfd.Filter  = "文本文件 (*.txt)|*.txt|所有文件 (*.*)|*.*";
    if(sfd.ShowDialog() == DialogResult.Cancel)
        return;
    bool bFileExisted = System.IO.File.Exists(sfd.FileName);
    System.IO.StreamWriter f_name = new System.IO.StreamWriter(sfd.FileName, bFileExisted, System.Text.Encoding.Default);
    //打印表头
    if(!bFileExisted)
        f_name.WriteLine ("SJJK0101~~销售单据传入");
    for(i_row=1;i_row<=outBlock.blk_info [1].row;i_row++)
    {
        outBlock.BlockNow = 2;
        f_name.WriteLine ("//单据{0}",i_row);    
        f_name.WriteLine ("{0}~~{1}~~{2}~~{3}~~{4}~~{5}~~{6}~~{7}~~{8}",outBlock.GetColVal(i_row,"invoice_num_10").ToString(),outBlock.GetColVal(i_row,"invoice_seq_num").ToString(),outBlock.GetColVal(i_row,"settle_user_name").ToString(),outBlock.GetColVal(i_row,"tax_num").ToString(),outBlock.GetColVal(i_row,"sett_user_addr_name").ToString(),outBlock.GetColVal(i_row,"account_num").ToString(),outBlock.GetColVal(i_row,"all_remark").ToString(),efCB_shenhe.Text.ToString().Trim(),efCB_kaipiao.Text.ToString().Trim());
        invoice_num = outBlock.GetColVal(i_row,"invoice_num_10").ToString();
        for(r_row=1;r_row<=outBlock.blk_info[2].row;r_row++)
        {
            outBlock.BlockNow = 3;
            if(outBlock.GetColVal(r_row,"invoice_num_10").ToString() == invoice_num)
            {
                f_name.WriteLine ("{0}~~{1}~~{2}~~{3}~~{4}~~{5}~~{6}~~{7}~~{8}~~{9}~~{10}",outBlock.GetColVal(r_row,"chinese_prod_abbr").ToString()+outBlock.GetColVal(r_row,"sg_sign").ToString().Trim(),"",outBlock.GetColVal(r_row,"stand").ToString(),outBlock.GetColVal(r_row,"weight_ready_tot").ToString(),outBlock.GetColVal(r_row,"good_amount").ToString(),outBlock.GetColVal(r_row,"tax_rate").ToString(),"1601",outBlock.GetColVal(r_row,"interest").ToString(),outBlock.GetColVal(r_row,"amount_tax").ToString(),0,0);
            }
        }
    }
    f_name.Close();
    this.EFMsgInfo = "写入txt成功!";      
  • 相关阅读:
    开发技术--Numpy模块
    开发技术-IPython介绍
    开发--Deepin系统安装
    开发--CentOS-7安装及配置
    开发技术--设计模式
    English--音标重难点
    English--音标拼读
    English--辅音
    jQuery火箭图标返回顶部代码
    jQuery火箭图标返回顶部代码
  • 原文地址:https://www.cnblogs.com/quke123/p/4102843.html
Copyright © 2020-2023  润新知