C# Microsoft.Office.Interop.Excel引出的数据不能计算怎么办,如何用VBA实现,可加到200分。
来源:百度知道 编辑:UC知道 时间:2024/05/31 04:03:47
private void btnExport_Click(object sender, EventArgs e)
{
int iRows = 0;
int iCols = 0;
int iTrueCols = 0;
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Add(System.Reflection.Missing.Value);
Microsoft.Office.Interop.Excel.Worksheet ws = null;
if (wb.Worksheets.Count > 0)
{
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.get_Item(1);
}
else
{
wb.Worksheets.Add(System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.get_Item(1);
{
int iRows = 0;
int iCols = 0;
int iTrueCols = 0;
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wb = app.Workbooks.Add(System.Reflection.Missing.Value);
Microsoft.Office.Interop.Excel.Worksheet ws = null;
if (wb.Worksheets.Count > 0)
{
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.get_Item(1);
}
else
{
wb.Worksheets.Add(System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value,
System.Reflection.Missing.Value);
ws = (Microsoft.Office.Interop.Excel.Worksheet)wb.Worksheets.get_Item(1);
ws.get_Range(ws.Cells[1, 1], ws.Cells[iRows, iCols]).Value2 = dimArray;
应该是这个,不能整体赋值
另外
Microsoft.Office.Interop.Excel.Application app = new Microsoft.Office.Interop.Excel.Application();
这行应该不能编译吧, new 的是 ApplicationClass();
其他的地方也有点疑问,只是手头上没有Office,没法给你试
Microsoft Rise Of Nations是什么?
Microsoft Visual Studio 2005 C#实验题
Microsoft Visual C# / Basic .NET
关于Microsoft Visual C# 2005 Express Edition的一个问题
c#代码在microsoft visual studio 2005怎么用.
Microsoft Visual C# 2005 Express Edition怎样生成exe文件
Greek Corruption, the European Court of Justice, Fairness, and Microsoft
you need to validate your copy of Microsoft Windows
His wealth, is based on his company, Microsoft, of which he owns 39% of the shares.
我用Microsoft Visual Studio 2005 作C#时,不能调试,但是生成的exe没问题。