asp 调用 excel

如果定义了两个字符串,a="aaaa"b="bbbb"想在EXCEL的A1,A3显示,如何啊?... 如果定义了两个字符串,
a = "aaaa"
b = "bbbb"
想在EXCEL的 A1,A3显示,如何啊?
展开
 我来答
妙酒
2007-08-09 · TA获得超过186万个赞
知道顶级答主
回答量:42万
采纳率:93%
帮助的人:20.6亿
展开全部
using System;
using Excel;

namespace ExcelExample
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class ExcelClass
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Excel.Application excelApp = new Excel.ApplicationClass(); // Creates a new Excel Application
excelApp.Visible = false; // Makes Excel visible to the user.

// The following line adds a new workbook
Excel.Workbook newWorkbook = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);

// The following code opens an existing workbook
string workbookPath = "c:/SomeWorkBook.xls"; // Add your own path here
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath, 0,
false, 5, "", "", false, Excel.XlPlatform.xlWindows, "", true,
false, 0, true, false, false);

// The following gets the Worksheets collection
Excel.Sheets excelSheets = excelWorkbook.Worksheets;

// The following gets Sheet1 for editing
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item(currentSheet);

// The following gets cell A1 for editing
Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("A1", "A1");

// The following sets cell A1's value to "Hi There"
excelCell.Value2 = "Hi There";
}
}
百度网友e4fa2136e
2007-08-09 · TA获得超过244个赞
知道小有建树答主
回答量:1067
采纳率:0%
帮助的人:228万
展开全部
i don't know
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式