private void cbbzongtigeshi_SelectedIndexChanged(object sender, EventArgs e)
        {
            //加载总体格式
            DBHelper mydbhelper = new DBHelper(Environment.CurrentDirectory + "\\ruitengdb.db");

            mydbhelper.Open();
            List <object> list_data = mydbhelper.ExecuteRow("select * from tablesplit where totalname='" + cbbzongtigeshi.Text + "'", null, null);

            //加载段落
            myflp.Controls.Clear();
            foreach (object o in list_data)
            {
                UCformate2w uce2w = new UCformate2w(o);
                uce2w.Dock = DockStyle.Top;
                myflp.Controls.Add(uce2w);
            }
            //加载选中标题
            flpfield.Controls.Clear();
            Dictionary <string, object> dic = list_data[0] as Dictionary <string, object>;

            string[] arr_allfields = dic["allfields"].ToString().Split(new char[] { ',', ',' });
            for (int i = 0; i < arr_allfields.Length; i++)
            {
                Label lbl_field = new Label
                {
                    Text        = arr_allfields[i],
                    TextAlign   = ContentAlignment.MiddleCenter,
                    BorderStyle = BorderStyle.FixedSingle,
                    Width       = 80,
                    Margin      = new Padding(1, 1, 1, 1)
                };
                lbl_field.Click += Mylbl_Click;
                flpfield.Controls.Add(lbl_field);
            }
            string[] arr_title = dic["titlefields"].ToString().Split(new char[] { ',', ',' });
            foreach (Control c in flpfield.Controls)
            {
                if (arr_title.Contains(c.Text))
                {
                    c.BackColor = Color.SteelBlue;
                    c.ForeColor = Color.White;
                }
            }



            //foreach (object o in list_data)
            //{
            //    Dictionary<string, object> dic = o as Dictionary<string, object>;
            //    cbbzongtigeshi.Items.Add(dic["totalname"]);
            //}
            mydbhelper.Close();
        }
Ejemplo n.º 2
0
        private void cbbzongtigeshi_TextChanged(object sender, EventArgs e)
        {
            //加载总体格式
            //List<object> list_data = myMySqlHelper.ExecuteRow("select * from tablesplit where totalname='" + cbbzongtigeshi.Text + "'", null, null);
            Dictionary <string, object> mydic = new Dictionary <string, object> {
                { "totalname", cbbzongtigeshi.Text }
            };

            var list_data = _mycontroller._sqlhelper.GetAnySet("tablesplit", mydic);

            //加载段落
            myflp.Controls.Clear();
            foreach (object o in list_data)
            {
                UCformate2w uce2w = new UCformate2w(o);
                uce2w.Dock = DockStyle.Top;
                myflp.Controls.Add(uce2w);
            }
            //加载选中标题
            flpfield.Controls.Clear();
            if (list_data.Count == 0)
            {
                return;
            }
            Dictionary <string, object> dic = list_data[0] as Dictionary <string, object>;

            string[] arr_allfields = dic["alltitle"].ToString().Split(new char[] { ',', ',' });
            for (int i = 0; i < arr_allfields.Length; i++)
            {
                Label lbl_field = new Label
                {
                    Text        = arr_allfields[i],
                    TextAlign   = ContentAlignment.MiddleCenter,
                    BorderStyle = BorderStyle.FixedSingle,
                    Width       = 80,
                    Margin      = new Padding(1, 1, 1, 1)
                };
                lbl_field.Click += Mylbl_Click;
                flpfield.Controls.Add(lbl_field);
            }
            string[] arr_title = dic["titlefields"].ToString().Split(new char[] { ',', ',' });
            foreach (Control c in flpfield.Controls)
            {
                if (arr_title.Contains(c.Text))
                {
                    c.BackColor = Color.SteelBlue;
                    c.ForeColor = Color.White;
                }
            }
        }
        private void lblconvert_Click(object sender, EventArgs e)
        {
            //判断输出路径是否存在
            string importpath = tbcunfang.Text;

            if (!Directory.Exists(importpath))
            {
                MessageBox.Show("保存路径不存在!");
                return;
            }
            // UpdateStatue("正在提取文本格式……");
            /*识别所有的mycu*/
            UCformate2w myuc = null;

            for (int i = 0; i < myflp.Controls.Count; i++)
            {
                myuc          = new UCformate2w();
                myuc          = ((UCformate2w)myflp.Controls[i]);
                myuc.mysetter = new Model.setter();
                //给myuc的setter赋值
                for (int j = 0; j < myuc.flp.Controls.Count; j++)
                {
                    Label mylbl0 = ((Label)myuc.flp.Controls[j]);
                    if (mylbl0.BackColor == Color.SteelBlue)
                    {
                        myuc.mysetter.listcolumn.Add(mylbl0.TabIndex);
                    }
                }
                //myuc.mysetter.listcolumn = GetContent(tbfilename.Text, rowindex, myuc);
                myuc.mysetter.hangjustyle = myuc.cbblinespace.Text;
                myuc.mysetter.hangjuvalue = Convert.ToSingle(myuc.nudlinespace.Value);
                myuc.mysetter.fontname    = myuc.tbfontname.Text;
                myuc.mysetter.fontsize    = Convert.ToSingle(myuc.nudfontsize.Value);
                myuc.mysetter.juzhong     = myuc.cbbposition.Text;
                myuc.mysetter.bold        = myuc.cbbold.Checked ? 1 : 0;
                myuc.mysetter.suojin      = Convert.ToSingle(myuc.nudsuojin.Value);
                myuc.mysetter.konghang    = Convert.ToInt32(myuc.cbbkonghang.Text);
                //把uc提取到集合中
                Global.list_myuc.Add(myuc);
            }

            //接收选中的列用于文件名
            Label mylbl = null;

            for (int i = 0; i < flpfield.Controls.Count; i++)
            {
                mylbl = ((Label)flpfield.Controls[i]);
                if (mylbl.BackColor == Color.SteelBlue)
                {
                    Global.listfilename.Add(mylbl.TabIndex);
                }
            }
            Thread t = null;

            for (int m = 0; m < dgv_task.Rows.Count; m++)
            {
                try
                {
                    while (t.ThreadState == ThreadState.Running)
                    {
                        Application.DoEvents();
                    }
                }
                catch { }
                t      = new Thread(CreateDocument);
                t.Name = "thread_" + m;

                t.Start(Global.list_splitfiles[m]);
            }

            /*提示完成*/
            UpdateStatue("版权所有 深圳前海极简信息咨询服务有限公司!");
        }