Esempio n. 1
0
        private void exportExcel_Click(object sender, EventArgs e)
        {
            String filePath = new Maticsoft.Common.INIFile().IniReadValue("config", "downloadPath");;
            String fileName = "member.xls";
            String[] title = new String[] { "会员卡号", "卡面号", "会员姓名" ,"手机号码","邮件","性别","当前等级", "当前积分", "当前余额", "累计消费", "会员卡状态" };
            int[] width = new int[] { 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20 };

            VipSoft.BLL.MemCard memCard = new BLL.MemCard();
            DataSet ds = memCard.GetExportList(condition);

            VipSoft.Common.NPOI2.ExcelInfo  ei = new VipSoft.Common.NPOI2.ExcelInfo();
            ei.filePath = filePath + fileName;
            VipSoft.Common.NPOI2.ExcelUtils.writeExcel(ds.Tables[0], ei, title, width);

            SaveFileDialog SaveFile = new SaveFileDialog();
            SaveFile.FileName = fileName;
            SaveFile.Filter = "Miscrosoft Office Excel 97-2003 工作表|*.xls|所有文件(*.*)|*.*";
            SaveFile.RestoreDirectory = true;
            if (SaveFile.ShowDialog() == DialogResult.OK)
            {
                String destFName = SaveFile.FileName;
                System.IO.File.Copy(filePath+fileName, destFName, true);//文件另存为
                MessageBox.Show("文件导出成功");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 绑定产品单位数据字典
 /// </summary>
 private void LoadGoodsUnit()
 {
     string[] units = new Maticsoft.Common.INIFile().IniReadValue("config", "GoodsUnit").Split("|".ToCharArray());
     this.comboBox_Unit.Items.Clear();
     foreach (string unit in units)
     {
         if (unit.Trim() != "")
             comboBox_Unit.Items.Add(unit.Trim());
     }
 }