日期:2014-05-17  浏览次数:20831 次

将二位数组的数据导入到excle中
小弟又遇到问题了·以前做VB的 excel还算顺手,这次让做C#的 对于语法上的转换还是有些困难,希望各位帮忙,上代码
   object[,] VarValue = new object[dtResult.Rows.Count, 15];

            for (int i = 0; i < dtResult.Rows.Count;i++ )
            {
                VarValue[i, 0] = i;
                VarValue[i, 1] = dtResult.Rows[i]["ProductName"].ToString();
                VarValue[i, 2] = "";
                VarValue[i, 3] = "";
                VarValue[i, 4] = dtResult.Rows[i]["RealityQuantity"].ToString();
                VarValue[i, 5] = "";
                VarValue[i, 6] = dtResult.Rows[i]["EstimatePrice"].ToString();
                VarValue[i, 7] = "";
                VarValue[i, 8] = dtResult.Rows[i]["Application"].ToString();
                VarValue[i, 9] = "";
                VarValue[i, 10] = dtResult.Rows[i]["PaymentPattern"].ToString();
                VarValue[i, 11] = "";
                VarValue[i, 12] = dtResult.Rows[i]["Remarks"].ToString();
                VarValue[i, 13] = "";
                VarValue[i, 14] = "";
                VarValue[i, 15] = "";
            }

          //  excelWS.Range("A7:U" & CStr(REC.RowCount + 6))._Default = VB6.CopyArray(VarValue)