[已关闭问题]
<P>如下形式的表格我们可以用如下代码进行矩阵填充 </P>
<P> A B C D E<BR> +--------------+<BR>1|1 | 1 | 1 | 1 |<BR> +--------------+<BR>2|1 | 1 | 1 | 1 |<BR> +--------------+<BR>3|1 | 1 | 1 | 1 |<BR> +--------------+<BR>4|1 | 1 | 1 | 1 |<BR> +--------------+</P>
<P> protected void Button2_Click(object sender, EventArgs e)<BR> {<BR> Excel.Application xApp = new Excel.ApplicationClass();<BR> xApp.DisplayAlerts = false; //屏蔽alert<BR> xApp.Visible = false;<BR> Excel.Workbook xBook = xApp.Workbooks._Open(@"C:\A.xls",<BR> Missing.Value, Missing.Value, Missing.Value, Missing.Value<BR> , Missing.Value, Missing.Value, Missing.Value, Missing.Value<BR> , Missing.Value, Missing.Value, Missing.Value, Missing.Value);</P>
<P> Excel.Worksheet xSheet = (Excel.Worksheet)xBook.Sheets[1];<BR> Excel.Range rng1 = xSheet.get_Range("A1", Type.Missing);<BR> //写入数据 <BR> object[,] objData = new Object[4, 4];<BR> objData[0, 0] = 1;<BR> objData[1, 0] = 1;<BR> objData[2, 0] = 1;<BR> objData[3, 0] = 1;<BR> <BR> objData[0, 1] = 1;<BR> objData[1, 1] = 1;<BR> objData[2, 1] = 1;<BR> objData[3, 1] = 1;</P>
<P> objData[0, 2] = 1;<BR> objData[1, 2] = 1;<BR> &a
使名扬
|
菜鸟二级
|
园豆:
230
提问于:2008-02-05 12:02