我正在尝试将datagridview下载到excel。以下是我正在使用的代码。
// X - 值
string[] arrRootCause = {"Batch Issue","Change Request","CICS Online Entry Error","Data Conversion Issue","Data Requirement Incorrect", "GS Code Issue","Incorrect in FS","In-house Code Issue","Integration Error","JCL/PARAM/PROC Issue","Load issue","Missing in FS","Others","Query","Region Data Incorrect","TBA","Understanding Issue","VisionPLUS Base code Issue"};
// Y1和Y2值:
int[] TCStatus2 = { 3, 4, 53, 23, 53, 63, 83, 93, 13, 3, 93, 73, 43, 43, 23, 33, 43, 53 };
int[] TCStatus3 = { 53, 42, 5, 23, 23, 93, 13, 33, 63, 36, 13, 11, 63, 13, 93, 73, 13, 73 };
//将数据存入List
List<StackedBarChartData> sbcData = new List<StackedBarChartData>();
for (int i = 0; i < arrRootCause.Length; i++)
{
StackedBarChartData sb = new StackedBarChartData();
sb.Y1Values = TCStatus3[i];
sb.Y2Values = TCStatus2[i];
sb.XValues = arrRootCause[i];
sbcData.Add(sb);
}
dataGridView1.DataSource = sbcData;
执行Windows窗体应用程序后,我得到如下输出,
XValues Y1Values Y2Values
Batch Issue 53 3
Change Request 42 4
CICS Online Ent... 5 53
Data Conversion... 23 23
Data Requiremen… 23 53
GS Code Issue 93 63
Incorrect in FS 13 83
In-house Code I... 33 93
Integration Err... 63 13
JCL/PARAM/PROC ... 36 3
Load issue 13 93
Missing in FS 11 73
Others 63 43
Query 13 43
Region Data Inc... 93 23
TBA 73 33
Understanding I... 13 43
如上所示,CICS Online Ent ...即将发布而不是CICS Online Entry Error。 arrRootCause中的其他一些字符串也是如此。
我尝试增加列的宽度,但没有用。
任何人都可以帮助我理解问题所在。
TIA。