private void PrintTechnicalSpecification() { if (technicalSpetificationsBindingSource.Count == 0) { MessageBox.Show("Техническое задание не может быть распечатано, т.к. не указан файл.", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } dbDataSet.TechnicalSpetificationsRow ts = (technicalSpetificationsBindingSource.Current as DataRowView).Row as dbDataSet.TechnicalSpetificationsRow; string path = ts.Path; if (!File.Exists(path)) { MessageBox.Show("Техническое задание не может быть распечатано, т.к. не найден указанный файл!", "Внимание!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Word.Application app = new Word.Application(); Word.Document doc = app.Documents.Open(path); app.Visible = true; }
private void OpenTsFile(object sender, EventArgs e) { openTsDialog.InitialDirectory = Path.GetDirectoryName(Application.ExecutablePath); DialogResult res = openTsDialog.ShowDialog(); if (res == DialogResult.OK) { if (technicalSpetificationsBindingSource.Count == 0) { dbDataSet.OrdersRow order = (ordersBindingSource.Current as DataRowView).Row as dbDataSet.OrdersRow; technicalSpetificationsTableAdapter.Insert(order.Id, openTsDialog.FileName); technicalSpetificationsTableAdapter.Fill(dbDataSet.TechnicalSpetifications); } else { dbDataSet.TechnicalSpetificationsRow ts = (technicalSpetificationsBindingSource.Current as DataRowView).Row as dbDataSet.TechnicalSpetificationsRow; ts.Path = openTsDialog.FileName; technicalSpetificationsTableAdapter.Update(ts); } } }