You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.6 KiB
60 lines
1.6 KiB
3 years ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Data;
|
||
|
using System.Drawing;
|
||
|
using System.Text;
|
||
|
using System.Windows.Forms;
|
||
|
|
||
|
namespace Stone.Common
|
||
|
{
|
||
|
public partial class frmExport : Form
|
||
|
{
|
||
|
DataGridView _dgrd;
|
||
|
public frmExport()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
public void ShowExport(DataGridView dgrd)
|
||
|
{
|
||
|
_dgrd = dgrd;
|
||
|
this.ShowDialog();
|
||
|
}
|
||
|
|
||
|
private void frmExport_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
MyExport.List(this.checkedListBox1, _dgrd);
|
||
|
}
|
||
|
|
||
|
private void btnOK_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
if (this.checkedListBox1.CheckedIndices.Count <= 0)
|
||
|
{
|
||
|
MessageBox.Show("请选择要导出的字段!");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (this.rbtExcel.Checked)
|
||
|
{
|
||
|
this.saveFileDialog1.Filter = "Excel 文件(*.xlsx)|*.xlsx|Excel 文件(*.xls)|*.xls";
|
||
|
this.saveFileDialog1.Title = "导出Excel文件";
|
||
|
if (this.saveFileDialog1.ShowDialog() == DialogResult.OK)
|
||
|
{
|
||
|
|
||
|
if (this.saveFileDialog1.FilterIndex == 1)
|
||
|
{
|
||
|
|
||
|
MyExport.ExportExcelX(this.saveFileDialog1.FileName, this.checkedListBox1, _dgrd);
|
||
|
}
|
||
|
|
||
|
if (this.saveFileDialog1.FilterIndex == 2)
|
||
|
{
|
||
|
|
||
|
MyExport.ExportExcel(this.saveFileDialog1.FileName, this.checkedListBox1, _dgrd);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|