Ejemplo n.º 1
0
        /// <summary>
        /// 简历文件导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExport_Click(object sender, EventArgs e)
        {
            if (dgvData.SelectedRows.Count > 0)
            {
                int    resumeid     = int.Parse(dgvData.SelectedRows[0].Cells[1].Value.ToString());
                string templatefile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "技術者履歴書_模板.xlsx");
                if (!File.Exists(templatefile))
                {
                    MessageBox.Show("テンプレートファイルが存在しません。");
                    return;
                }
                SaveFileDialog dlg = new SaveFileDialog();

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    NCExcel excel = new NCExcel();
                    excel.OpenExcelFile(templatefile);
                    excel.SelectSheet(1);
                    ExportBaseInfo(excel, resumeid);
                    ExportStudyInfo(excel, resumeid);
                    ExportWorkInfo(excel, resumeid);
                    excel.SaveAs(dlg.FileName);
                    excel.Close();
                }
            }
        }
Ejemplo n.º 2
0
        private void btnExcel_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string  fileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "テーブル定義書.xls");
                NCExcel execel   = new NCExcel();
                execel.OpenExcelFile(fileName);
                execel.SelectSheet(1);
                int idx = 7;
                // add table list
                foreach (Tbl tbl in tables)
                {
                    execel.setValue(2, idx, (idx - 6).ToString());
                    execel.setValue(4, idx, tbl.name);
                    idx++;
                }
                // add sheet
                execel.AddSheet(tables);
                // add sheet data
                for (int i = 0; i < tables.Count; i++)
                {
                    execel.SelectSheet(i + 2);
                    execel.setValue(2, 2, "HighwayHR");
                    execel.setValue(4, 2, "HRWeb");
                    execel.setValue(9, 2, "Highwayns");
                    execel.setValue(11, 2, DateTime.Now.ToString("yyyy/MM/dd"));
                    execel.setValue(2, 4, tables[i].name);
                    idx = 7;
                    for (int j = 0; j < tables[i].fields.Count; j++)
                    {
                        execel.setValue(2, idx, (idx - 6).ToString());
                        execel.setValue(3, idx, tables[i].fields[j]);
                        execel.setValue(4, idx, tables[i].fields_type[j]);
                        execel.setValue(5, idx, tables[i].fields_size[j].Replace("(", "").Replace(")", ""));
                        if (tables[i].fields_null[j] == "NOT NULL")
                        {
                            execel.setValue(7, idx, "○");
                        }
                        if (tables[i].pk.IndexOf(tables[i].fields[j]) > -1)
                        {
                            execel.setValue(8, idx, "○");
                        }
                        execel.setValue(9, idx,
                                        tables[i].fields_increase[j] + "/"
                                        + tables[i].fields_default[j] + "/"
                                        + tables[i].fields_sign[j]);
                        idx++;
                    }
                }
                execel.SaveAs(dlg.FileName);
                MessageBox.Show("Save Over!");
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// file Export
        /// </summary>
        /// <param name="fileName"></param>
        private void FileExport(string fileName)
        {
            int     resumeid     = int.Parse(dgvData.SelectedRows[0].Cells[1].Value.ToString());
            string  templatefile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "技術者履歴書_模板.xlsx");
            NCExcel excel        = new NCExcel();

            excel.OpenExcelFile(templatefile);
            excel.SelectSheet(1);
            ExportBaseInfo(excel, resumeid);
            ExportWorkInfo(excel, resumeid);
            excel.SaveAs(fileName);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create Publish
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPublish_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string  fileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "コンサルテントテンプレート.xlsx");
                NCExcel execel   = new NCExcel();
                execel.OpenExcelFile(fileName);
                execel.SelectSheet(1);
                int idx = 2;
                // add table list
                foreach (DataGridViewRow row in dgvData.Rows)
                {
                    string companyName = row.Cells[1].Value.ToString();
                    string departName  = row.Cells[14].Value.ToString();
                    string manager     = row.Cells[2].Value.ToString();
                    string postcode    = row.Cells[3].Value.ToString();
                    string address     = row.Cells[4].Value.ToString();
                    string tel         = row.Cells[5].Value.ToString();
                    string fax         = row.Cells[6].Value.ToString();
                    string mail        = row.Cells[12].Value.ToString();
                    string web         = row.Cells[13].Value.ToString();
                    string comment     = row.Cells[11].Value.ToString();

                    execel.setValue(1, idx, companyName);
                    execel.setValue(2, idx, departName);
                    execel.setValue(3, idx, comment);
                    execel.setValue(4, idx, manager);
                    execel.setValue(5, idx, mail);
                    execel.setValue(6, idx, postcode);
                    execel.setValue(7, idx, address);
                    execel.setValue(8, idx, tel);
                    execel.setValue(12, idx, fax);
                    execel.setValue(13, idx, web);
                    idx++;
                }
                execel.SaveAs(dlg.FileName);
                MessageBox.Show("Save ExcelOver!\r\n there are " + dgvData.Rows.Count + " record!");
            }
        }
Ejemplo n.º 5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                string  fileName = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "お客様テンプレート.xlsx");
                NCExcel execel   = new NCExcel();
                execel.OpenExcelFile(fileName);
                execel.SelectSheet(1);
                int idx = 3;
                // add table list
                foreach (DataGridViewRow row in dgvData.Rows)
                {
                    string comment     = row.Cells[0].Value.ToString();
                    string companyName = row.Cells[1].Value.ToString();
                    string departName  = row.Cells[2].Value.ToString();
                    string address     = row.Cells[3].Value.ToString();

                    companyName = companyName + departName;
                    string[] strs = companyName.Split(' ');
                    if (strs.Length == 2)
                    {
                        companyName = strs[0];
                        departName  = strs[1];
                    }
                    execel.setValue(2, idx, companyName);
                    execel.setValue(3, idx, departName);
                    execel.setValue(6, idx, address);
                    execel.setValue(7, idx, comment);
                    idx++;
                }
                execel.SaveAs(dlg.FileName);
                MessageBox.Show("Save Over!");
            }
        }