private void button1_Click(object sender, EventArgs e)
        {
            шаблоны uRow = bindingSource1.Current as шаблоны;

            клШаблон.выбран = true;
            клШаблон.путь   = uRow.путь;
            Close();
        }
Exemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            шаблоны newRow = new шаблоны();

            //newRow.шаблон = Guid.NewGuid();
            newRow.наимен = "Новый шаблон...";
            newRow.путь   = "";
            int строка = bindingSource1.Add(newRow);

            bindingSource1.Position = строка;
        }
Exemplo n.º 3
0
        private void button4_Click(object sender, EventArgs e)
        {
            шаблоны uRow = bindingSource1.Current as шаблоны;

            Word.Application oWord = new Word.Application();

            string curDir = System.IO.Directory.GetCurrentDirectory();

            object шаблон = curDir + @"\" + uRow.путь.Trim();

            if (!System.IO.File.Exists(шаблон.ToString()))
            {
                MessageBox.Show("Нет файла " + шаблон.ToString());
                return;
            }

            Word.Document o = oWord.Documents.Open(FileName: шаблон);
            oWord.Application.Visible = true;
        }
Exemplo n.º 4
0
        void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                if (dataGridView1.Columns[e.ColumnIndex] == путьColumn)
                {
                    dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex];
                    string curDir = System.IO.Directory.GetCurrentDirectory();

                    string шаблон = curDir + @"\договор_теле.dot";



                    шаблоны uRow = bindingSource1.Current as шаблоны;

                    if (uRow.путь.Trim().Length > 0)
                    {
                        шаблон = curDir + @"\" + uRow.путь.Trim();
                    }

                    openFileDialog1.CheckFileExists  = true;
                    openFileDialog1.CheckPathExists  = true;
                    openFileDialog1.InitialDirectory = curDir;
                    openFileDialog1.Title            = "Выберите щаблон для договора ";
                    openFileDialog1.FileName         = шаблон;
                    DialogResult dr = openFileDialog1.ShowDialog();
                    if (dr == System.Windows.Forms.DialogResult.OK)
                    {
                        System.IO.FileInfo fi = new System.IO.FileInfo(openFileDialog1.FileName);

                        uRow.путь      = fi.Name;
                        label1.Visible = true;
                    }
                }
            }
        }