Exemplo n.º 1
0
        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);
                    }
                }
            }
        }
Exemplo n.º 2
0
        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);
                    }
                }
            }
        }