winform里报表预览的界面如下:
点击"XLsExport"按钮后,生成Excel文档,Excel文档的线条是错乱的,不知道为什么?
"XLsExport"按钮的代码如下:
private void button1_Click(object sender, EventArgs e)
{
XlsExport oXlsExport = new XlsExport();
SaveFileDialog sfd = new SaveFileDialog();
Cursor tmpCursor = Cursor;
// Display the save dialog.
sfd.Title = "Xls files should be saved with electronic signature";//Title
sfd.FileName = ""; // Name of the file for initial display
sfd.Filter = "Xls|*.Xls"; // Filter
if (sfd.ShowDialog() != DialogResult.OK)
{
return;
}
try
{
// Change the cursor.
Cursor = Cursors.WaitCursor;
Application.DoEvents();
// Location
// Export the file.
oXlsExport.Export(arvMain.Document, sfd.FileName);
//Start the output file (Open)
System.Diagnostics.Process.Start(sfd.FileName);
// Display the notification message.
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
// Replace the cursor
Cursor = tmpCursor;
Application.DoEvents();
// End processing
sfd.Dispose();
oXlsExport.Dispose();
}
} |