Esempio n. 1
0
        public static void ExportExcel(Dictionary<string, List<PJ_qxfl>> objdic)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\06设备巡视及缺陷消除记录.xls";

            ex.Open(fname);
            int zc = 20;
            //与会人员之间的间隔符号
            char[] jksign = new char[1] { ';' };
            int row = 7;
            int col = 1;
            int len1 = 3;
            int pageindex = 1;
            pageindex = objdic.Count;
            //根据所有的线路数来确定创建的页数
            for (int j = 1; j <= pageindex; j++)
            {
                if (j > 1)
                {
                    ex.CopySheet(1, 1);
                }
            }
            int pags = 0;
            foreach (KeyValuePair<string, List<PJ_qxfl>> pp in objdic)
            {
                List<PJ_qxfl> objlist = pp.Value;
                ex.ActiveSheet(pags++);

            }

        }
Esempio n. 2
0
        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public void ExportExcel()
        {
            ////lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\局设备评级计划.xls";
            ex.Open(fname);

            string strfirst = "";
            string filter = "";

            filter = "  where 1=1 ";
            if (isWorkflowCall)
            {
                filter = filter + " and id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowId='"
                    + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                        + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                    + "    RecordID='" + currRecord.ID + "') "
                    ;
            }
            IList<PJ_jsbpjjh> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_jsbpjjh>(
             filter
               );
            ExportExcel(ex, datalist);




            ex.ShowExcel();
        }
        public void ExportExcelYear(string orgid, string year) {
            ////lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\设备标志缺失变更明细表二.xls";
            ex.Open(fname);

            string strfirst = "";
            string filter = "";

            filter = "  where 1=1 ";
            if (orgid != "") filter += " and OrgCode='" + orgid + "'";

            if (isWorkflowCall) {
                filter = filter + " and id not in (select ModleRecordID from WF_ModleRecordWorkTaskIns where  WorkFlowId='"
                    + WorkFlowData.Rows[0]["WorkFlowId"].ToString() + "') "
                        + " or id in  (select ModleRecordID from WF_ModleRecordWorkTaskIns where "
                    + "    RecordID='" + currRecord.ID + "') "
                    ;
            }
            IList<PJ_sbbzqsbgmxb2> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_sbbzqsbgmxb2>(
             filter
               );
            ExportExcel(ex, datalist, orgid);

            ex.ShowExcel();
        }
Esempio n. 4
0
        public void ExportExcelMonth(DateTime dt, DateTime dt2, string orgid)
        {
            //lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\所月度停电计划.xls";
            ex.Open(fname);
            string startday = "20";
            IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
                string.Format("select nr from pj_dyk where  dx='所月度停电计划' and sx like '%{0}%' and nr!=''", "申报截止日期"));
            if (list.Count > 0)
                startday=list[0].ToString();
            string str = " where (TDtime between '" +dt.Year + "-"
                + dt.Month + "-" + dt.Day
                + " 00:00:00' and  '"
                + dt2.Year + "-"
                + dt2.Month + "-" + dt2.Day + " 23:59:59' ) ";
            if (orgid != "") str += " and OrgCode='" + orgid + "'";
            IList<PJ_tdjh> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_tdjh>(
               str
                );
            ExportExcel(dt, ex, datalist);
            ex.ShowExcel();

        }
Esempio n. 5
0
    private static void ReadExcelDecks()
    {
        DataRowCollection collect = ExcelAccess.ReadExcel("Res/Excel/GameData.xlsx", "decks");

        for (int i = 2; i < collect.Count; i++)
        {
            DeckProperty role = new DeckProperty
            {
                id = int.Parse(collect[i][0].ToString())
            };
            string   value = collect[i][1].ToString();
            string[] array = value.Split(',');
            if (array == null || array.Length == 0)
            {
                role.Deck = new int[] { int.Parse(value) }
            }
            ;
            else
            {
                role.Deck = new int[array.Length];
                for (int k = 0; k < array.Length; k++)
                {
                    role.Deck[k] = int.Parse(array[k]);
                }
            }
            AssetDatabase.CreateAsset(role, "Assets/Res/DataAsset/deck/deck" + role.id + ".asset");
        }
    }
Esempio n. 6
0
        public static void Print(PrintType printType, BarcodeSample sample, TestResult technic, TestResult reality)
        {
            ExcelAccess access   = new ExcelAccess();
            string      path     = ConfigurationManager.AppSettings["template"];
            string      fullPath = Path.GetFullPath(path);

            access.Open(fullPath);
            access.IsVisibledExcel = true;
            access.FormCaption     = "商品条码符号检测数据";
            switch (printType)
            {
            case PrintType.Print:
                access.Print();
                break;

            case PrintType.PrintView:
                access.PrintPreview();
                break;

            default:
                access.Close();
                break;
            }
            access.Close();
        }
Esempio n. 7
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(sdjl_26 obj) {
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\送电17防护通知书.xls";
     int sz = 30;//一行最多30个
     ex.Open(fname);
     //此处写填充内容代码
     ex.ActiveSheet(1);
     //通知单位
     ex.SetCellValue(obj.tzdw, 5, 1);
     //电压
     ex.SetCellValue(obj.lineVol, 6, 7);
     //线路
     ex.SetCellValue(obj.c1, 6, 9);
     //发现问题
     List<string> fxwtList = GetList(obj.fxwt, sz);
     for (int i = 0; i < fxwtList.Count; i++)
     {
         ex.SetCellValue(fxwtList[i], 7+i, 1);
         if (i > 1)
             break;
     }
     //处理措施
     List<string> clcsList = GetList(obj.clcs, sz);
     for (int i = 0; i < clcsList.Count; i++)
     {
         ex.SetCellValue(obj.clcs, 12+i, 1);
         if (i > 2)
             break;
     }
    
    ex.ShowExcel();
 }
Esempio n. 8
0
 public static void ExportExcel(PJ_23 obj, ExcelAccess ex) {
     
     ex.SetCellValue(obj.jf + ":", 5, 4);
     ex.SetCellValue(obj.xybh, 4, 8);
     ex.SetCellValue(obj.cqdw + ":", 6, 4);
     string linename = "";
     if (obj.linename.Contains("线")) {
         linename = obj.linename.Substring(0, obj.linename.LastIndexOf("线"));
     } else
         linename = obj.linename;
     string[] filtchar = { "V", "v" };
     for (int i = 0; i < filtchar.Length; i++) {
         if (linename.Contains(filtchar[i])) {
             linename = linename.Substring(linename.LastIndexOf(filtchar[i]) + 1);
         }
     }
     ex.SetCellValue(linename, 10, 7);
     string fzlinename = "";
     if (obj.fzlinename.Contains("支")) {
         fzlinename = obj.fzlinename.Substring(0, obj.fzlinename.LastIndexOf("支"));
     } else
         fzlinename = obj.fzlinename;
     ex.SetCellValue(fzlinename, 10, 10);
     ex.SetCellValue("'" + obj.gh, 10, 16);
     ex.SetCellValue(obj.cqfw, 11, 4);
     ex.SetCellValue(obj.cqdw + "。", 13, 4);
     ex.SetCellValue(obj.jf, 17, 4);
     //ex.SetCellValue(obj.cqdw, 15, 8);
     ex.SetCellValue(obj.qdrq.Year.ToString(), 21, 7);
     ex.SetCellValue(obj.qdrq.Month.ToString(), 21, 9);
     ex.SetCellValue(obj.qdrq.Day.ToString(), 21, 11);
 }
Esempio n. 9
0
    //查询menu表
    public static List <Menu> SelectMenuTable()
    {
        string            excelName = Excel + ".xlsx";
        string            sheetName = "sheet1";
        DataRowCollection collect   = ExcelAccess.ReadExcel(excelName, sheetName);

        List <Menu> menuArray = new List <Menu>();

        for (int i = 1; i < collect.Count; i++)
        {
            if (collect[i][1].ToString() == "")
            {
                continue;
            }

            Menu menu = new Menu
            {
                m_Id       = collect[i][0].ToString(),
                m_level    = collect[i][1].ToString(),
                m_parentId = collect[i][2].ToString(),
                m_name     = collect[i][3].ToString()
            };
            menuArray.Add(menu);
        }
        return(menuArray);
    }
Esempio n. 10
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
              SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = "";
            saveFileDialog1.Filter = "Microsoft Excel (*.xls)|*.xls";


            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                fname = saveFileDialog1.FileName;
                try
                {
                    dsoFramerControl1.FileSave(saveFileDialog1.FileName, true);
                    
                    if (MsgBox.ShowAskMessageBox("导出成功,是否打开该文档?") != DialogResult.OK)
                    {
                       
                        ExcelAccess ex = new ExcelAccess();
                        ex.Open(fname);
                        //此处写填充内容代码
                        ex.ShowExcel();
                        return;
                    }
                }
                catch
                {
                    MsgBox.ShowSuccessfulMessageBox("无法保存" + fname + "。请用其他文件名保存文件,或将文件存至其他位置。");
                    return;
                }
            }
        }
Esempio n. 11
0
    public static List <ExcelTableEntity> SelectTables(string tableName)
    {
        DataRowCollection       collect = ExcelAccess.ReadExcel(tableName, SheetNames[0]);
        List <ExcelTableEntity> list    = new List <ExcelTableEntity>();

        for (int i = 1; i < collect.Count; i++)
        {
            ExcelTableEntity e = new ExcelTableEntity();
            if (collect[i][0].ToString() == "")
            {
                continue;
            }
            e.ID   = collect[i][0].ToString();
            e.Type = collect[i][1].ToString();
            if (tableName == ExcelName)
            {
                e.Time             = collect[i][2].ToString();
                e.TimeContent      = collect[i][3].ToString();
                e.WinningContent   = collect[i][4].ToString();
                e.FailContent      = collect[i][5].ToString();
                e.FialContentDrop  = collect[i][6].ToString();
                e.WinTime          = collect[i][7].ToString();
                e.FailTime         = collect[i][8].ToString();
                e.WinningAfter     = collect[i][9].ToString();
                e.WinningAfterTime = collect[i][10].ToString();
            }
            list.Add(e);
        }
        return(list);
    }
Esempio n. 12
0
        internal static void ExportCK(string rkid) {
            ExcelAccess ea = new ExcelAccess();
            string filename = AppDomain.CurrentDomain.BaseDirectory + "\\00记录模板\\.xls";
            if (!File.Exists(filename))
            {
                //导出资源文件到本机
                Stream obj = typeof(PrintHelper).Assembly.GetManifestResourceStream("Ebada.Kcgl._00记录模板..xls");
                object[] files = typeof(PrintHelper).Assembly.GetManifestResourceNames();
                if (obj != null) {
                    byte[] buff = new byte[obj.Length];
                    obj.Read(buff, 0, (int)obj.Length);

                    FileStream fs = new FileStream(filename, FileMode.OpenOrCreate);
                    fs.Write(buff, 0, buff.Length);
                    fs.Flush();
                    fs.Close();
                    fs.Dispose();
                }

            }
            ea.Open(filename);

          
            //显示文件
            ea.Print();
            ea.DisPoseExcel();
        }
Esempio n. 13
0
        public static void ExportExcel10KV(IList<PS_kgjctj> datalist)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\10KV用户供电可靠性基础数据统计表.xls";
            ex.Open(fname);

            int rowcount = 1;
            if (datalist.Count < 1) return;
            string tablename = "10KV用户供电可靠性基础数据统计表";
            if (tablename.Length > 30)
            {
                tablename = tablename.Substring(tablename.Length - 31);
            }
            //
            //加页
            int pageindex = datalist.Count;

            for (int j = 1; j < pageindex; j++)
            {
                ex.CopySheet(1, j);
                ex.ReNameWorkSheet(j + 1, tablename + "(" + (j) + ")");
            }
            for (int j = 0; j < datalist.Count; j++)
            {
                if (j == 0)
                {
                    ex.ActiveSheet(tablename);
                }
                else
                {
                    ex.ActiveSheet(tablename + "(" + j + ")");
                }
                // 填值
                ex.SetCellValue(datalist[j].OrgName, 3, 2);
                ex.SetCellValue(datalist[j].CreateTime.ToString("yyyy年MM月dd日"), 5, 9);
                ex.SetCellValue(datalist[j].kgModel, 5, 2);
                ex.SetCellValue(datalist[j].iscxkg == true ? "是" : "否", 5, 7);
                ex.SetCellValue(datalist[j].kgCode, 5, 9);
                ex.SetCellValue(datalist[j].jkdxcd, 10, 2);
                ex.SetCellValue(datalist[j].dlxlcd, 10, 7);
                ex.SetCellValue(datalist[j].publicusercount.ToString(), 11, 2);
                ex.SetCellValue(datalist[j].publicbtcount.ToString(), 11, 5);
                ex.SetCellValue(datalist[j].publicbtrlcount.ToString(), 11, 9);
                ex.SetCellValue(datalist[j].zyusercount.ToString(), 12, 2);
                ex.SetCellValue(datalist[j].zybtcount.ToString(), 12, 5);
                ex.SetCellValue(datalist[j].zybtrlcount.ToString(), 12, 9);

                ex.SetCellValue(datalist[j].sdyusercount.ToString(), 13, 2);
                ex.SetCellValue(datalist[j].sdyrlcount.ToString(), 13, 5);
                ex.SetCellValue(datalist[j].zyuserqtsbcount.ToString(), 13, 9);

                ex.SetCellValue(datalist[j].drqcount.ToString(), 14, 2);
                ex.SetCellValue(datalist[j].drqrl, 14, 5);
                ex.SetCellValue(datalist[j].zyuserqtsbrlcount.ToString(), 14, 9);
            }
            ex.ActiveSheet(tablename);
            ex.ShowExcel();
        }
Esempio n. 14
0
 public void ExportExcelMonth(string orgid)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\充油设备密封点台账.xls";
  
 }
Esempio n. 15
0
        public void ExportExcel(ExcelAccess ex, IList<PJ_clcrkd> datalist, string wpmc)
        {
            //此处写填充内容代码
            int row = 5;
            int col = 2;
            int rowcount = 18;

            //

            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }
            for (int j = 1; j <= pageindex; j++)
            {

                ex.CopySheet(1, j);
                if (j == 1) ex.ReNameWorkSheet(j + 1, wpmc);
                else
                    ex.ReNameWorkSheet(j + 1, wpmc + (j));
            }
            for (int j = 0; j < datalist.Count; j++)
            {

                if (j % rowcount == 0)
                {
                    if (j == 0) ex.ActiveSheet(wpmc);
                    else ex.ActiveSheet(wpmc + (j / rowcount + 1));

                }
                ex.SetCellValue(datalist[j].wpmc, row + j % rowcount, col );
                ex.SetCellValue(datalist[j].wpgg, row + j % rowcount, col + 1);

                ex.SetCellValue(datalist[j].wpdw, row + j % rowcount, col + 2);
                ex.SetCellValue(datalist[j].wpsl, row + j % rowcount, col + 3);
                ex.SetCellValue(datalist[j].wpdj, row + j % rowcount, col + 4);
                ex.SetCellValue(datalist[j].wpcj, row + j % rowcount, col + 5);
                ex.SetCellValue(datalist[j].indate.ToString("yyyy年MM月dd日"), row + j % rowcount, col + 6);
                ex.SetCellValue(datalist[j].ssgc, row + j % rowcount, col + 7);
                if(datalist[j].type.IndexOf ("入库单")==-1)
                ex.SetCellValue(datalist[j].ckdate.ToString("yyyy年MM月dd日"), row + j % rowcount, col + 8);
                ex.SetCellValue(datalist[j].yt, row + j % rowcount, col + 9);
                ex.SetCellValue(datalist[j].cksl, row + j % rowcount, col + 10);
                ex.SetCellValue(datalist[j].cksl, row + j % rowcount, col + 11);
                ex.SetCellValue(datalist[j].lqdw, row + j % rowcount, col + 12);
                //ex.SetCellValue(datalist[j].zrr, row + j % rowcount, col + 7);
                if (datalist[j].wpmc == "出库合计")
                {
                    return;
                }


            }
        }
Esempio n. 16
0
        private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = "";
            saveFileDialog1.Filter = "Microsoft Excel (*.xls)|*.xls";


            if (saveFileDialog1.ShowDialog() == DialogResult.OK) {
                fname = saveFileDialog1.FileName;
                try {
                    dsoFramerControl1.FileSave(saveFileDialog1.FileName, true);
                    //dsoFramerControl1.Dispose();

                    //dsoExcelControl1.AxFramerControl.Save(fname,true,null,null);
                    // dsoExcelControl1.FileSaveAs(out fname);
                    //if (MsgBox.Show("导出成功!") != DialogResult.Yes)
                    //////MsgBox.Show("导出成功!");
                    //////dsoExcelControl1.AxFramerControl.Dispose();
                    //////return;

                    if (MsgBox.ShowAskMessageBox("导出成功,是否打开该文档?") != DialogResult.OK) {
                        //dsoExcelControl1.AxFramerControl.Dispose();
                        //dsoExcelControl1.Dispose();
                        ExcelAccess ex = new ExcelAccess();
                        //SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                        //string fname = Application.StartupPath + "\\00记录模板\\26防护通知书.xls";

                        ex.Open(fname);
                        //此处写填充内容代码

                        ex.ShowExcel();
                        //Microsoft.Office.Interop.Excel.Application exc = new Microsoft.Office.Interop.Excel.Application(); //引用Excel对象
                        //Microsoft.Office.Interop.Excel.Workbook book = exc.Application.Workbooks.Add(fname); //引用Excel工作簿
                        //exc.Visible = true; //使Excel可视
                        return;
                    }
                    //System.Diagnostics.Process.Start(fname);

                    //ExcelAccess ex = new ExcelAccess();
                    ////SaveFileDialog saveFileDialog1 = new SaveFileDialog();
                    ////string fname = Application.StartupPath + "\\00记录模板\\26防护通知书.xls";

                    //ex.Open(fname);
                    ////此处写填充内容代码

                    //ex.ShowExcel();




                    //  System.Diagnostics.Process.Start(fname);
                } catch {
                    MsgBox.ShowSuccessfulMessageBox("无法保存" + fname + "。请用其他文件名保存文件,或将文件存至其他位置。");
                    return;
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(object obj) {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\17线路条图.xls";

            ex.Open(fname);
            //此处写填充内容代码

           ex.ShowExcel();
        }
Esempio n. 18
0
    public static DataRowCollection GetCollection(string excelName)
    {
#if SERVER
        Singleton._log.Info("ExcelAccess file path=" + ExcelAccess.FilePath(excelName));
#endif
        FileStream       stream      = File.Open(ExcelAccess.FilePath(excelName), FileMode.Open, FileAccess.Read, FileShare.Read);
        IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);
        DataSet          result      = excelReader.AsDataSet();
        return(result.Tables[0].Rows);
    }
Esempio n. 19
0
 public DSOFramerControl() {
     
     InitializeComponent();
     myExcel = new ExcelAccess();
     desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
     tempPath = Path.GetTempPath();
     axFramerControl1.ActivationPolicy = DSOFramer.dsoActivationPolicy.dsoKeepUIActiveOnAppDeactive;
     axFramerControl1.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoSetOnFirstOpen;
     //this.axFramerControl1.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrintPreview, false);
 }
Esempio n. 20
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(sdjl_23 obj)
 {
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\送电16电力设备产权、维护范围协议书.xls";
     if (obj.BigData != null)
     {
         if (obj.BigData.Length > 10)
         {
             fname = Path.GetTempPath() + "送电16电力设备产权、维护范围协议书.xls";
             //MemoryStream ms = new MemoryStream(obj.BigData);
             FileStream fs = new FileStream(fname, FileMode.OpenOrCreate);
             fs.Write(obj.BigData, 0, obj.BigData.Length);
             fs.Flush();
             fs.Close();
         }
     }
     ex.Open(fname);
     ex.SetCellValue(obj.jf, 5, 4);
     ex.SetCellValue(obj.xybh, 4, 11);
     ex.SetCellValue(obj.cqdw + ":", 6, 4);
     string linename = "";
     if (obj.linename.Contains("线"))
     {
         linename = obj.linename.Substring(0, obj.linename.LastIndexOf("线"));
     }
     else
         linename = obj.linename;
     string[] filtchar = { "V", "v" };
     for (int i = 0; i < filtchar.Length; i++)
     {
         if (linename.Contains(filtchar[i]))
         {
             linename = linename.Substring(linename.LastIndexOf(filtchar[i]) + 1);
         }
     }
     ex.SetCellValue(linename,9, 9);
     //string fzlinename = "";
     //if (obj.fzlinename.Contains("支"))
     //{
     //    fzlinename = obj.fzlinename.Substring(0, obj.fzlinename.LastIndexOf("支"));
     //}
     //else
     //    fzlinename = obj.fzlinename;
     //ex.SetCellValue(fzlinename, 10, 10);
     ex.SetCellValue(obj.cqfw, 10, 4);
     ex.SetCellValue("'" + obj.gh, 9, 12);
     ex.SetCellValue(obj.cqdw+"。", 12, 4);
     ex.SetCellValue(obj.jf, 11, 4);
     ex.SetCellValue(obj.qxydd, 15, 8);
     ex.SetCellValue(obj.qdrq.Year.ToString(), 21, 11);
     ex.SetCellValue(obj.qdrq.Month.ToString(), 21, 13);
     ex.SetCellValue(obj.qdrq.Day.ToString(), 21, 16);
     ex.ShowExcel();
 }
Esempio n. 21
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public  void ExportExcel(IList<PJ_21dyjcdcbkchild> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\电压检测点抄表卡.xls";
     ex.Open(fname);
     ExportExcel(ex, datalist);
     ex.ShowExcel();
    
 }
Esempio n. 22
0
        public void ExportExcelMonth(string orgid)
        {
            //lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\客户电力电容器台帐.xls";
            ex.Open(fname);
           
            ex.ShowExcel();

        }
Esempio n. 23
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public  void ExportExcel(IList<PJ_tdjh> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\所月度停电计划.xls";
     ex.Open(fname);
     ExportExcel(DateTime.Now, ex, datalist);
     ex.ShowExcel();
    
 }
Esempio n. 24
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public  void ExportExcel(IList<PJ_sdytz> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\双电源台账.xls";
     ex.Open(fname);
     ExportExcel(ex, datalist);
     ex.ShowExcel();
    
 }
Esempio n. 25
0
    public static void ExportExcel()
    {
        string excelName = "william_test.xlsx";
        string sheetName = "randomTest";
        string path      = Application.dataPath + "/" + excelName;

        ExcelAccess.WriteExcel(excelName, sheetName, path);

        AssetDatabase.Refresh();

        Debug.Log("ExportExcel Success!");
    }
Esempio n. 26
0
        public void ExportExcel(ExcelAccess ex, IList<PJ_anqgjcrkd> datalist, string wpmc)
        {
            //此处写填充内容代码
            int row = 4;
            int col = 1;
            int rowcount = 18;

            //

            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }
            for (int j = 1; j <= pageindex; j++)
            {

                ex.CopySheet(1, j);
                if (j == 1) ex.ReNameWorkSheet(j + 1, wpmc);
                else
                    ex.ReNameWorkSheet(j + 1, wpmc + (j));
            }
            for (int j = 0; j < datalist.Count; j++)
            {

                if (j % rowcount == 0)
                {
                    if (j == 0) ex.ActiveSheet(wpmc);
                    else ex.ActiveSheet(wpmc + (j / rowcount + 1));

                }
                ex.SetCellValue((j + 1).ToString(), row + j % rowcount, col);
                ex.SetCellValue(datalist[j].wpmc, row + j % rowcount, col+1 );
                ex.SetCellValue(datalist[j].wpgg, row + j % rowcount, col + 2);

                ex.SetCellValue(datalist[j].wpdw, row + j % rowcount, col + 3);
                ex.SetCellValue(datalist[j].wpsl, row + j % rowcount, col + 4);
                ex.SetCellValue(datalist[j].wpcj, row + j % rowcount, col + 5);
                if (datalist[j].num.Length>0)
                ex.SetCellValue(datalist[j].num.Substring(datalist[j].num.Length-4), row + j % rowcount, col + 6);
                ex.SetCellValue(datalist[j].indate.ToString("yyyy年MM月dd日"), row + j % rowcount, col + 7);
                ex.SetCellValue(datalist[j].synx, row + j % rowcount, col + 9);
                if (datalist[j].syzq != "物品不需要试验")
                {
                    ex.SetCellValue(datalist[j].scsydate.ToString("yyyy年MM月dd日"), row + j % rowcount, col + 8);

                    ex.SetCellValue(datalist[j].syzq, row + j % rowcount, col + 10);
                }


            }
        }
Esempio n. 27
0
    private static void ReadExcelRounds()
    {
        DataRowCollection collect = ExcelAccess.ReadExcel("Res/Excel/GameData.xlsx", "rounds");

        for (int i = 2; i < collect.Count; i++)
        {
            RoundProperty role = new RoundProperty
            {
                id        = int.Parse(collect[i][0].ToString()),
                maxRound  = int.Parse(collect[i][1].ToString()),
                NeedPerse = collect[i][2].ToString() == "1"?true:false,
                Des       = collect[i][3].ToString(),
                TargetDes = collect[i][4].ToString(),
                playerId  = int.Parse(collect[i][5].ToString()),
                npcId     = int.Parse(collect[i][6].ToString()),
                title     = collect[i][7].ToString(),
                title0    = collect[i][8].ToString(),
                title1    = collect[i][9].ToString(),
            };
            List <string> rules = new List <string>();
            if (!collect[i].IsNull(10))
            {
                rules.Add(collect[i][10].ToString());
            }
            if (!collect[i].IsNull(11))
            {
                rules.Add(collect[i][11].ToString());
            }
            role.Rules = rules.ToArray();
            List <RoundGoal> funcList = new List <RoundGoal>();

            int N = (collect[i].ItemArray.Length - 11) / 4;
            for (int j = 0; j < N; j++)
            {
                if (collect[i].IsNull(12 + j * 4))
                {
                    j = N;
                    break;
                }
                RoundGoal temp = new RoundGoal();

                temp.GoalType      = (RoundGoalType)int.Parse(collect[i][12 + j * 4].ToString());
                temp.Target        = (TargetType)int.Parse(collect[i][13 + j * 4].ToString());
                temp.GoalCondition = (RoundGoalCondition)int.Parse(collect[i][14 + j * 4].ToString());
                temp.Value         = int.Parse(collect[i][15 + j * 4].ToString());

                funcList.Add(temp);
            }
            role.Goals = funcList.ToArray();
            AssetDatabase.CreateAsset(role, "Assets/Res/DataAsset/round/round" + role.id + ".asset");
        }
    }
Esempio n. 28
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public void ExportExcel(IList<PJ_clcrkd> datalist)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\生产台账.xls";
     ex.Open(fname);
     ExportExcel(ex, datalist, "生产物资管理生产台账");
     
     ex.DeleteSheet(1);
     ex.ShowExcel();
    
 }
Esempio n. 29
0
        public void ExportExcelCunJian(string orgid)
        {

            
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\供电所春秋查停电检修计划.xls";
            ex.Open(fname);
            string startmonth = "3", startday= "1", endmonth = "5", endtday = "31";
            IList list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
                string.Format("select nr  from pj_dyk where  dx='供电所春秋查停电检修计划' and sx like '%{0}%' and nr!=''", "春查停电检修开始日期"));
            if (list.Count > 0)
            {

                Regex r1 = new Regex(@"[0-9]+(?=月)");
                if(r1.Match(list[0].ToString()).Value!="")
                {
                    startmonth = r1.Match(list[0].ToString()).Value;
                }
                r1 = new Regex(@"(?<=月)[0-9]+");
                if (r1.Match(list[0].ToString()).Value != "")
                {
                    startday = r1.Match(list[0].ToString()).Value;
                }
            }
            list = Client.ClientHelper.PlatformSqlMap.GetList("SelectOneStr",
               string.Format("select nr  from pj_dyk where  dx='供电所春秋查停电检修计划' and sx like '%{0}%' and nr!=''", "春查停电检修截止日期"));
            if (list.Count > 0)
            {

                Regex r1 = new Regex(@"[0-9]+(?=月)");
                if (r1.Match(list[0].ToString()).Value != "")
                {
                    endmonth = r1.Match(list[0].ToString()).Value;
                }
                r1 = new Regex(@"(?<=月)[0-9]+");
                if (r1.Match(list[0].ToString()).Value != "")
                {
                    endtday = r1.Match(list[0].ToString()).Value;
                }
            }
            string str = " where 1=1 and  TDtime between '" + DateTime.Now.Year + "-" + startmonth + "-" + startday + " 00:00:00' and  cast('"
                + DateTime.Now.Year + "-" + endmonth + "-" + endtday + " 23:59:59' as datetime) ";
            if (orgid != "") str += " and OrgCode='" + orgid + "' ";
            IList<PJ_cqctdjxjh> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_cqctdjxjh>(
               str
                );
            ExportExcel(ex, datalist);
            ex.ShowExcel();
        }
Esempio n. 30
0
    static void BuildAssetBundlesExcell()
    {
        ExcelScriptObj es = ScriptableObject.CreateInstance <ExcelScriptObj>();

        es.voiceData = ExcelAccess.SelectTables(ExcelAccess.ExcelName);
        es.voiceType = ExcelAccess.SelectTables(ExcelAccess.ExcelType);
        if (File.Exists(holderPath))
        {
            File.Delete(holderPath);
        }
        AssetDatabase.CreateAsset(es, holderPath);
        Debug.Log("Build ScripteObj Success");
        AssetDatabase.Refresh();
    }
Esempio n. 31
0
    public static void ExcuteBuild()
    {
        BookHolder holder = ScriptableObject.CreateInstance <BookHolder>();

        //查询excel表中数据,赋值给asset文件
        holder.menus = ExcelAccess.SelectMenuTable();

        string path = "Assets/Resources/booknames.asset";

        AssetDatabase.CreateAsset(holder, path);
        AssetDatabase.Refresh();

        Debug.Log("BuildAsset Success!");
    }
Esempio n. 32
0
 public void ExportExcelYear(string orgid)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\备品备件计划.xls";
     IList<PJ_bpbjjhb> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_bpbjjhb>(
         " where jhnf = '" + (DateTime.Now.Year+1) + "'"
         + " and OrgCode='" + orgid + "'"
         );
     ex.Open(fname);
     ExportExcel(ex, datalist);
     ex.ShowExcel();
 }
Esempio n. 33
0
    private static void ReadExcelCards()
    {
        DataRowCollection collect = ExcelAccess.ReadExcel("Res/Excel/GameData.xlsx", "cards");

        for (int i = 2; i < collect.Count; i++)
        {
            CardProperty role = new CardProperty
            {
                id       = int.Parse(collect[i][0].ToString()),
                tid      = int.Parse(collect[i][1].ToString()),
                CardName = collect[i][2].ToString(),
                Des      = collect[i][3].ToString(),
            };
            List <FunctionData> funcList = new List <FunctionData>();

            int N = (collect[i].ItemArray.Length - 4) / 4;
            for (int j = 0; j < N; j++)
            {
                if (collect[i].IsNull(4 + j * 4))
                {
                    j = N;
                    break;
                }
                FunctionData temp = new FunctionData();

                temp.type   = (CardType)int.Parse(collect[i][4 + j * 4].ToString());
                temp.func   = (CardFunc)int.Parse(collect[i][5 + j * 4].ToString());
                temp.target = (TargetType)int.Parse(collect[i][6 + j * 4].ToString());
                string   value = collect[i][7 + j * 4].ToString();
                string[] array = value.Split(',');
                if (array == null || array.Length == 0)
                {
                    temp.Values = new int[] { int.Parse(value) }
                }
                ;
                else
                {
                    temp.Values = new int[array.Length];
                    for (int k = 0; k < array.Length; k++)
                    {
                        temp.Values[k] = int.Parse(array[k]);
                    }
                }
                funcList.Add(temp);
            }
            role.functions = funcList.ToArray();
            AssetDatabase.CreateAsset(role, "Assets/Res/DataAsset/card/card" + role.id + ".asset");
        }
    }
        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public void ExportExcel(string orgid) {
            //lgm
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\设备标志缺失变更明细表二.xls";
            ex.Open(fname);
            string filter = "where 1=1 ";
            if (orgid != "") filter += " and OrgCode='" + orgid + "'";
            IList<PJ_sbbzqsbgmxb2> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_sbbzqsbgmxb2>(
             filter

               );
            ExportExcel(ex, datalist, orgid);
            ex.ShowExcel();
        }
Esempio n. 35
0
 void gridViewOperation_AfterAdd(PJ_24 e)
 {
     DSOFramerControl dsoFramerControl1 = new DSOFramerControl();
     Microsoft.Office.Interop.Excel.Workbook wb;dsoFramerControl1.FileData = e.BigData;
     wb = dsoFramerControl1.AxFramerControl.ActiveDocument as Microsoft.Office.Interop.Excel.Workbook;
     ExcelAccess ea = new ExcelAccess();
     ea.MyWorkBook = wb;
     ea.MyExcel = wb.Application;
     ea.SetCellValue(ParentObj.OrgName , 4, 9);
     dsoFramerControl1.FileSave();
     e.BigData = dsoFramerControl1.FileData;
     dsoFramerControl1.FileClose();
     dsoFramerControl1.Dispose();
     dsoFramerControl1 = null;
 }
Esempio n. 36
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public static void ExportExcel(PJ_23 obj)
 {
     ExcelAccess ex = new ExcelAccess();
     string fname = Application.StartupPath + "\\00记录模板\\23配电线路产权维护范围协议书.xls";
     if (obj.BigData != null && obj.BigData.Length > 10) {
         fname = Path.GetTempPath() + "23配电线路产权维护范围协议书.xls";
         //MemoryStream ms = new MemoryStream(obj.BigData);
         FileStream fs = new FileStream(fname, FileMode.OpenOrCreate);
         fs.Write(obj.BigData, 0, obj.BigData.Length);
         fs.Flush();
         fs.Close();
     }
     ex.Open(fname);
     ExportExcel(obj, ex);
     ex.ShowExcel();
 }
Esempio n. 37
0
    private static void ReadExcelRoles()
    {
        DataRowCollection collect = ExcelAccess.ReadExcel("Res/Excel/GameData.xlsx", "roles");

        for (int i = 2; i < collect.Count; i++)
        {
            RoleProperty role = new RoleProperty
            {
                id     = int.Parse(collect[i][0].ToString()),
                Money  = int.Parse(collect[i][1].ToString()),
                Honor  = int.Parse(collect[i][2].ToString()),
                Amity  = int.Parse(collect[i][3].ToString()),
                DeckId = int.Parse(collect[i][4].ToString())
            };
            AssetDatabase.CreateAsset(role, "Assets/Res/DataAsset/role/role" + role.id + ".asset");
        }
    }
Esempio n. 38
0
 /// <summary>
 /// 文档格式预定义好的,只填写内容
 /// </summary>
 /// <param name="obj"></param>
 public void ExportExcel(string orgid)
 {
     //lgm
     ExcelAccess ex = new ExcelAccess();
     SaveFileDialog saveFileDialog1 = new SaveFileDialog();
     string fname = Application.StartupPath + "\\00记录模板\\电压监测装置设置台帐.xls";
     ex.Open(fname);
    
         IList<PJ_dyjczzsztz> datalist = Client.ClientHelper.PlatformSqlMap.GetListByWhere<PJ_dyjczzsztz>(
            " where OrgCode='" + orgid + "' order by id"
            );
         ExportExcel(ex, datalist);
     
    
     ex.ShowExcel();
    
 }
Esempio n. 39
0
    static void BuildAssetBundlesExcell()
    {
        ExcelScriptObj es = ScriptableObject.CreateInstance <ExcelScriptObj>();

        es.voiceData = ExcelAccess.SelectTables(ExcelAccess.ExcelName);
        es.voiceType = ExcelAccess.SelectTables(ExcelAccess.ExcelType);
        if (File.Exists(voicePath))
        {
            File.Delete(voicePath);
        }
        AssetDatabase.CreateAsset(es, voicePath);
        AssetDatabase.SaveAssets();
        //EditorUtility.FocusProjectWindow();
        Selection.activeObject = es;
        Debug.Log("Build ScripteObj_Audio Success");
        AssetDatabase.Refresh();
    }
Esempio n. 40
0
        public void ExportExcel(ExcelAccess ex, IList<PJ_sdytz> datalist)
        {
            //此处写填充内容代码
            int row = 5;
            int col = 1;
            int rowcount =14;

            //

            //加页
            int pageindex = 1;
            if (pageindex < Ecommon.GetPagecount(datalist.Count, rowcount))
            {
                pageindex = Ecommon.GetPagecount(datalist.Count, rowcount);
            }
            for (int j = 1; j <= pageindex; j++)
            {
                if (j > 1)
                {
                    ex.CopySheet(1, 1);
                }
            }
            for (int j = 0; j < datalist.Count; j++)
            {
                if (j % rowcount == 0)
                {
                    ex.ActiveSheet(j / rowcount + 1);
                }
                ex.SetCellValue(((j + 1)).ToString(), row + j % rowcount, col);

                ex.SetCellValue(datalist[j].khmc, row + j % rowcount, col + 1);
                ex.SetCellValue(datalist[j].khdz, row + j % rowcount, col + 2);
                ex.SetCellValue(datalist[j].zdyOrgName, row + j % rowcount, col + 3);
                ex.SetCellValue(datalist[j].zdyLineName, row + j % rowcount, col + 4);
                ex.SetCellValue(datalist[j].zdykgModle, row + j % rowcount, col + 5);
                ex.SetCellValue(datalist[j].fdyOrgName, row + j % rowcount, col + 6);
                ex.SetCellValue(datalist[j].fdyLineName, row + j % rowcount, col + 7);
                ex.SetCellValue(datalist[j].fdykgModle, row + j % rowcount, col + 8);
                ex.SetCellValue(datalist[j].kgfs, row + j % rowcount, col + 9);
                ex.SetCellValue(datalist[j].Remark, row + j % rowcount, col + 10);

            }
           
        }
Esempio n. 41
0
        /// <summary>
        /// 根据入库单id,导出入库单
        /// </summary>
        /// <param name="rkid"></param>
        internal static void ExportRK(string rkid) {
            ExcelAccess ea = new ExcelAccess();
            string filename=AppDomain.CurrentDomain.BaseDirectory+"\\00记录模板\\.xls";
            if (!File.Exists(filename))
            {
                //导出资源文件到本机
                Stream obj = typeof(PrintHelper).Assembly.GetManifestResourceStream("Ebada.Kcgl._00记录模板..xls");
                object[] files = typeof(PrintHelper).Assembly.GetManifestResourceNames();
                if (obj != null) {
                    byte[] buff = new byte[obj.Length];
                    obj.Read(buff, 0, (int)obj.Length);

                    FileStream fs = new FileStream(filename, FileMode.OpenOrCreate);
                    fs.Write(buff, 0, buff.Length);
                    fs.Flush();
                    fs.Close();
                    fs.Dispose();
                }
                
            }
            ea.Open(filename);

            JH_yearks rkobj=Client.ClientHelper.TransportSqlMap.GetOneByKey<JH_yearks>(rkid);
            if(rkobj==null)return;
            
            int brow = 5;
            int bcol = 2;
            //填充数据
            //for (int i = 0; i < list.Count; i++) {
            //    var obj = list[i];
            //    ea.SetCellValue((i+1).ToString(), i + brow, bcol-1);
            //    ea.SetCellValue(kcname, i + brow, bcol);
            //    ea.SetCellValue(obj.供货厂家, i + brow, bcol + 1);
            //    ea.SetCellValue(obj.材料名称, i + brow, bcol + 2);
            //    ea.SetCellValue(obj.规格及型号, i + brow, bcol + 3);
            //    ea.SetCellValue(obj.计量单位, i + brow, bcol + 4);
            //    ea.SetCellValue(obj.数量.ToString(), i + brow, bcol + 5);
            //    ea.SetCellValue(obj.备注, i + brow, bcol + 6);
            //}

            //显示文件
            ea.Print();
            ea.DisPoseExcel();
        }
Esempio n. 42
0
        /// <summary>
        /// 文档格式预定义好的,只填写内容
        /// </summary>
        /// <param name="obj"></param>
        public static void ExportExcel(PJ_24 jl)
        {
            ExcelAccess ex = new ExcelAccess();
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            string fname = Application.StartupPath + "\\00记录模板\\24设备变更通知书.xls";

            ex.Open(fname);
            int row = 1;
            int col = 1;
            //
            ex.SetCellValue(jl.sj.Year.ToString(), row + 8, col);
            ex.SetCellValue(jl.sj.Month.ToString(), row + 8, col+2);
            ex.SetCellValue(jl.sj.Day.ToString(), row + 8, col+4);
            ex.SetCellValue(jl.dd, row + 5, col+6);
            ex.SetCellValue(jl.nr, row + 5, col + 7);
            ex.SetCellValue(jl.Remark, row + 5, col + 10);

            ex.ShowExcel();
        }
Esempio n. 43
0
    IEnumerator StartAnalyze()
    {
        DirectoryInfo directoryInfo = new DirectoryInfo(FX_PATH);

        FileInfo[] files = directoryInfo.GetFiles("*.prefab", SearchOption.AllDirectories);

        while (mReportList.Count < files.Length)
        {
            if (!isCoroutineRunning)
            {
                string fxPath = files[mReportList.Count].DirectoryName.Substring(files[mReportList.Count].DirectoryName.LastIndexOf("Assets"));
                fxPath.Replace("\\", "/");
                fxPath = fxPath + "/" + files[mReportList.Count].Name;
                this.transform.name = string.Format("Analyzing...({0}/{1})", mReportList.Count, files.Length);
                yield return(StartCoroutine(AnalyzeSingleFx(fxPath)));
            }
        }

        ExcelAccess.WriteExcel(mReportList, ExcelAccess.FilePath("EffectReportTool/EffectReport.xlsx"));
        AssetDatabase.Refresh();
    }
Esempio n. 44
0
    public List <PersonCell> GetPersonTable()
    {
        DataRowCollection collect = ExcelAccess.GetCollection("Person.xls");
        List <PersonCell> list    = new List <PersonCell>();

        for (int i = 1; i < collect.Count; i++)
        {
            if (collect[i][1].ToString() == "")
            {
                continue;
            }

            PersonCell cell = new PersonCell();
            cell._id          = int.Parse(collect[i][0].ToString());
            cell._name        = collect[i][1].ToString();
            cell._description = collect[i][2].ToString();
            cell._gold        = int.Parse(collect[i][3].ToString());
            list.Add(cell);
        }
        return(list);
    }
Esempio n. 45
0
        public static bool Save(BarcodeSample sample, TestResult technic, TestResult reality, string saveFilename, string templateFile)
        {
            ExcelAccess access = new ExcelAccess();

            access.Open(templateFile);
            access.IsVisibledExcel = true;
            access.FormCaption     = "商品条码符号检测数据";
            bool flag = false;

            access.SetCellText(2, "F", sample.SerialNumber);
            access.SetCellText(3, "F", sample.CustomerName);
            access.SetCellText(3, "Z", reality.BarcodeType);
            access.SetCellText(4, "F", sample.SampleName);
            access.SetCellText(4, "Z", sample.PrintFormat);
            access.SetCellText(6, "F", sample.CustomerContactPersoner);
            access.SetCellText(6, "N", sample.CustomerContactNumber);
            access.SetCellText(0x11, "J", "代办点" + sample.RegisterPoint);
            access.SetCellText(10, "J", technic.SymbolLevel);
            access.SetCellText(11, "J", technic.DecodingData);
            access.SetCellText(12, "J", "≥" + technic.LeftBlank);
            access.SetCellText(13, "J", "≥" + technic.RightBlank);
            access.SetCellText(14, "J", "≥" + technic.BarHeight.ToString());
            access.SetCellText(15, "J", technic.SizeOfZ);
            access.SetCellText(0x10, "J", technic.IsValidBarcode);
            access.SetCellText(10, "V", reality.SymbolLevel);
            access.SetCellText(11, "V", reality.DecodingData);
            access.SetCellText(12, "V", reality.LeftBlank);
            access.SetCellText(13, "V", reality.RightBlank);
            access.SetCellText(14, "V", reality.BarHeight.ToString());
            access.SetCellText(15, "V", reality.SizeOfZ.ToString());
            access.SetCellText(0x10, "V", reality.IsValidBarcode);
            access.SetCellText(6, "Z", reality.TestDate.ToString("yyyyMMdd"));
            if (access.SaveAs(saveFilename, false))
            {
                flag = true;
            }
            access.Close();
            return(flag);
        }
Esempio n. 46
0
    public static void XieRu()
    {
        string[]  strs;
        TextAsset ta = Resources.Load("ComponentColor2") as TextAsset;
        JsonData  jd = JsonMapper.ToObject(ta.ToString());

        strs = new string[jd.Count];
        for (int i = 0; i < jd.Count; i++)
        {
            strs[i] = jd[i]["name"].ToString();
        }
        for (int j = 0; j < strs.Length; j++)
        {
            for (int k = j + 1; k < strs.Length; k++)
            {
                if (strs[j] == strs[k])
                {
                    Debug.Log(strs[k]);
                }
            }
        }
        ExcelAccess.WriteExcel(strs, "ww.xlsx", "www");
    }
Esempio n. 47
0
        public void ImportExcelMethodHandler(Object obj, ImportExcelArgs ev)
        {
            #region 实现...

            ExcelAccess excel = new ExcelAccess();
            excel.Open();

            excel.MergeCells(1, 1, 1, this._body.Cols);             //合并单元格写标题,并设置字体
            excel.SetFont(1, 1, 1, this._body.Cols, this._title.Font);
            excel.SetCellText(1, 1, 1, this._body.Cols, this._title.Text);

            //打印网格及网格线
            excel.SetCellText((System.Data.DataTable) this.DataSource, 3, 1, true);

            System.Windows.Forms.FileDialog fileDlg = new System.Windows.Forms.SaveFileDialog();
            fileDlg.AddExtension = true;
            fileDlg.DefaultExt   = ".xls";

            //fileDlg.InitialDirectory = System.IO.Directory.GetCurrentDirectory();
            fileDlg.Title  = "保存到Excel文件";
            fileDlg.Filter = "Microsoft Office Excel 工作簿(*.xls)|*.xls|模板(*.xlt)|*.xlt";

            if (fileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (excel.SaveAs(fileDlg.FileName, true))
                {
                    System.Windows.Forms.MessageBox.Show("数据成功保存到Excel文件!", "GoldPrinter", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                }
            }

            fileDlg.Dispose();

            excel.Close();

            #endregion
        }
 public override async Task <StandardTagList> GetDataAsync(string path)
 {
     return(await ExcelAccess.GetStandardMappingSetAsync(path));
 }
Esempio n. 49
0
    public static void ParseXlsToPrto(string xmlFile, string outDirectory)
    {
        if (!xmlFile.ToLower().Contains("cfg_"))
        {
            return;
        }
        xmlFile = xmlFile.Replace("\\", "/");

        DataRowCollection data = ExcelAccess.ReadExcel(xmlFile, 0, ExcelAccess.ExcelType.xls);

        string name = Path.GetFileNameWithoutExtension(xmlFile);

        JCExcel excel = new JCExcel(xmlFile);

        StringBuilder sb = new StringBuilder();

        sb.AppendLine("package TABLE;");
        sb.AppendLine("import \"table_common.proto\";");
        sb.AppendLine("");
        sb.AppendLine(string.Format("message {0}", name.ToUpper()));

        sb.AppendLine("{");

        ContentType type         = ContentType.None;
        string      typeName     = string.Empty;
        string      protoName    = string.Empty;
        string      typeProperty = string.Empty;

        List <string> idLidst = new List <string>();

        for (int i = 0; i < excel.ColumnCount; i++)
        {
            if (excel.IsConformTypeNameNorm(i, out type, out protoName, out typeProperty))
            {
                if (type == ContentType.stringValue)
                {
                    typeName = "string";
                }
                else if (type == ContentType.floatValue)
                {
                    typeName = "float";
                }
                else
                {
                    typeName = type.ToString();
                }

                //每列数据的检查
                if (!excel.CheckColumnContent(i, type))
                {
                    continue;
                }

                if (string.IsNullOrEmpty(protoName))
                {
                    continue;
                }

                //避免同名的出现
                if (idLidst.Contains(protoName))
                {
                    MessageBox.Show(string.Format("{0} {1}列出现重复名称{2}", xmlFile, i + 1, protoName));
                    continue;
                }

                idLidst.Add(protoName);
                if (excel.GetTitle(i) == "合并字段")
                {
                    sb.AppendLine("    //" + excel.GetDesc(i));
                    sb.AppendLine(string.Format("\t{0}{1} {2} {3} = {4};",
                                                (excel.IsClientUse(i) ? "" : "//"), "required", typeName, protoName, i + 1));
                }
                else
                {
                    sb.AppendLine(string.Format("\t{0}{1} {2} {3} = {4};//{5}  {6}",
                                                (excel.IsClientUse(i) ? "" : "//"), typeProperty, typeName, protoName, i + 1, excel.GetTitle(i), excel.GetDesc(i)));
                }
            }
        }

        sb.AppendLine("}");

        sb.AppendLine("");

        sb.AppendLine(string.Format("message {0}", name.ToUpper() + "ARRAY"));

        sb.AppendLine("{");
        sb.AppendLine(string.Format("\trepeated {0} rows = 1;", name.ToUpper()));
        sb.AppendLine("}");

        Utility.SaveFileContent(outDirectory + "/c_table_" + name.ToLower() + ".proto", sb.ToString());
    }