private void menuItemBuildPdf_Click(object sender, EventArgs e) { IList <PDTable> tableList = new List <PDTable>(); string title = string.Empty; TreeNode node = tv.SelectedNode; if (node.Tag is PDModel) { PDModel m = node.Tag as PDModel; tableList = m.AllTableList; title = m.Name; } if (node.Tag is PDPackage) { PDPackage p = node.Tag as PDPackage; tableList = p.TableList; title = p.Name; } saveFileDialog1.FileName = title; saveFileDialog1.Filter = "pdf文件(*.pdf)|*.pdf|所有文件(*.*)|*.*"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fileName = saveFileDialog1.FileName; iTextExporter exporter = new iTextExporter(fileName); exporter.PDModel2Pdf(tableList, title); if (MsgBox.ShowQuestionMessage("数据库文档生成成功,是否打开文档", "提示信息") == DialogResult.Yes) { CmdHelper.Execute(fileName); } } }
private void btnOK_Click(object sender, EventArgs e) { List <SOTable> list = new List <SOTable>(); foreach (object item in listBox2.Items) { list.Add(item as SOTable); } if (list.Count == 0) { return; } if (rbtnPdf.Checked) { saveFileDialog1.Filter = "pdf文件(*.pdf)|*.pdf|所有文件(*.*)|*.*"; saveFileDialog1.FileName = CurrentDatabase.Name; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fileName = saveFileDialog1.FileName; iTextExporter exporter = new iTextExporter(fileName); exporter.DbSchema2Pdf(currentSchema, CurrentDatabase, list); if (MessageBox.Show("数据库文档生成成功,是否打开文档", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { CmdHelper.Execute(fileName); } } } if (rbtnWord.Checked) { saveFileDialog1.Filter = "rtf文件(*.rtf)|*.rtf|所有文件(*.*)|*.*"; saveFileDialog1.FileName = CurrentDatabase.Name; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fileName = saveFileDialog1.FileName; iTextExporter exporter = new iTextExporter(fileName); exporter.DbSchema2Rtf(currentSchema, CurrentDatabase, list); if (MessageBox.Show("数据库文档生成成功,是否打开文档", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { CmdHelper.Execute(fileName); } } } }
private void btnOK_Click(object sender, EventArgs e) { List<SOTable> list = new List<SOTable>(); foreach (object item in listBox2.Items) { list.Add(item as SOTable); } if (list.Count == 0) return; if (rbtnPdf.Checked) { saveFileDialog1.Filter = "pdf文件(*.pdf)|*.pdf|所有文件(*.*)|*.*"; saveFileDialog1.FileName = CurrentDatabase.Name; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fileName = saveFileDialog1.FileName; iTextExporter exporter = new iTextExporter(fileName); exporter.DbSchema2Pdf(currentSchema, CurrentDatabase, list); if (MessageBox.Show("数据库文档生成成功,是否打开文档", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { CmdHelper.Execute(fileName); } } } if (rbtnWord.Checked) { saveFileDialog1.Filter = "rtf文件(*.rtf)|*.rtf|所有文件(*.*)|*.*"; saveFileDialog1.FileName = CurrentDatabase.Name; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fileName = saveFileDialog1.FileName; iTextExporter exporter = new iTextExporter(fileName); exporter.DbSchema2Rtf(currentSchema, CurrentDatabase, list); if (MessageBox.Show("数据库文档生成成功,是否打开文档", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { CmdHelper.Execute(fileName); } } } }
private void menuItemBuildPdf_Click(object sender, EventArgs e) { IList<PDTable> tableList = new List<PDTable>(); string title = string.Empty; TreeNode node = tv.SelectedNode; if (node.Tag is PDModel) { PDModel m = node.Tag as PDModel; tableList = m.AllTableList; title = m.Name; } if (node.Tag is PDPackage) { PDPackage p = node.Tag as PDPackage; tableList = p.TableList; title = p.Name; } saveFileDialog1.FileName = title; saveFileDialog1.Filter = "pdf文件(*.pdf)|*.pdf|所有文件(*.*)|*.*"; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { string fileName = saveFileDialog1.FileName; iTextExporter exporter = new iTextExporter(fileName); exporter.PDModel2Pdf(tableList, title); if (MessageBox.Show("数据库文档生成成功,是否打开文档", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { CmdHelper.Execute(fileName); } } }