示例#1
0
    public int Expore_Ex(int Pl_Code, IList <CRMDB.EX_Param> _p_s, string fileName)
    {
        BL_Export   _b_ex = new BL_Export();
        NPOI_Common Excel = new NPOI_Common();

        //获取Title
        Excel.Ex_Titel     = _b_ex.getEx_Title(Pl_Code);
        Excel.Ex_FieldName = _b_ex.getFieldName(Pl_Code);
        Excel.Ex_Data      = _b_ex.getEx_Data(Pl_Code, _p_s);
        BL_Reports _bl_r   = new BL_Reports();
        DataTable  _type50 = _bl_r.GetExport_Type50(Pl_Code, 50);

        if (_type50 != null && _type50.Rows.Count > 0)
        {
            //FN_FieldName,FN_Desc_EN,FN_Desc_CN
            List <string> _Title_Field = new List <string>();
            List <string> _Title       = new List <string>();
            List <string> _Title_Data  = new List <string>();
            for (int i = 0; i < _type50.Rows.Count; i++)
            {
                _Title_Field.Add(_type50.Rows[i]["FN_FieldName"].ToString());
                if (Language.GetLang2() == EM_Language.en_us)
                {
                    _Title.Add(_type50.Rows[i]["FN_Desc_EN"].ToString());
                }
                else
                {
                    _Title.Add(_type50.Rows[i]["FN_Desc_CN"].ToString());
                }
            }
            for (int i = 0; i < Excel.Ex_Data.Columns.Count; i++)
            {
                _Title_Data.Add(Excel.Ex_Data.Columns[i].Caption);
            }
            foreach (string _t in _Title_Field)
            {
                Excel.Ex_FieldName.Remove(_t);
            }
            foreach (string _t in _Title)
            {
                Excel.Ex_Titel.Remove(_t);
            }
            foreach (string _t in _Title_Field)
            {
                foreach (string _t_t in _Title_Data)
                {
                    if (_t_t.StartsWith(_t))
                    {
                        Excel.Ex_Titel.Add(_t_t);
                        Excel.Ex_FieldName.Add(_t_t);
                    }
                }
            }
        }
        Excel.Create_Ex(fileName);
        Excel.Seave_Ex(fileName);
        return((int)_errCode.success);
    }
示例#2
0
        public void Expore_Ex(int Pl_Code, int PR, out string fileName)
        {
            fileName = SetDownFileName();
            NPOI_Common Excel = new NPOI_Common();

            //获取Title
            Excel.Ex_Titel     = getEx_Title(Pl_Code);
            Excel.Ex_FieldName = getFieldName(Pl_Code);
            Excel.Ex_Data      = getEx_Data(Pl_Code, PR);

            Excel.Create_Ex(_sheetTitle);
            Excel.Seave_Ex(fileName);
        }