如何在excel中使用for循环填充excel中的数据库值 [英] how to fill the database value in excel using for loop in excel

查看:281
本文介绍了如何在excel中使用for循环填充excel中的数据库值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表名如下批次



批处理表记录如下



Batchid
B001

B002



表名如下反馈



Facid Q1 Q2 Q3 Batchid



1 2 4 5 B001

2 3 3 4 B001

1 4 5 5 B002

2 3 3 4 B002



在excel中,我想从批处理表中按行排列Batchid,如下所示/>


B001 B002



类似于excel我想将反馈表中的Facid放在列中,如下所示/>


类似于excel我想从反馈表中选择Q1 Q2和Q3列如下



Facid Q1 Q2 Q3

1 2 4 5

2 3 3 4

1 4 5 5

2 3 3 4

excel中的
如何使用c3在asp.net中放置上面的值,使用for循环。



请帮助我,我怎么能在asp中做.net使用c#。



问候,

Jegan B.

Table name as follows Batch

In Batch table record as follows

Batchid
B001
B002

Table name as follows Feedback

Facid Q1 Q2 Q3 Batchid

1 2 4 5 B001
2 3 3 4 B001
1 4 5 5 B002
2 3 3 4 B002

In excel i want to place Batchid in row wise from Batch table as follows

B001 B002

similarily in excel i want to place Facid in column wise from Feedback table as follows
and
similarily in excel i want to place Q1 Q2 and Q3 column wise from feedback table as follows

Facid Q1 Q2 Q3
1 2 4 5
2 3 3 4
1 4 5 5
2 3 3 4

in excel how to place above values in asp.net using c3, using for loop.

please help me for that how can i do in asp.net using c#.

Regards,
Jegan B.

推荐答案

我不明白一个字,但似乎你需要以下内容

I didn't understand a single word, but it seem you need something as following
var excelApp = new ApplicationClass {Visible = false}; //use Application for .NET 4.0 and later

var excelWorkbooks = excelApp.Workbooks.Open("yourfilepath");
var excelWorkSheet = (Worksheet) excelWorkbooks.Sheets[yourWorkSheetNumber]; //be sure to cast to  Workseet explictly
excelWorkSheet.Cells[row, column] = yourvalue;
excelWorkbooks.Save(); //calling excelApp.Save(); would cause an exception
excelApp.Quit();
Marshal.ReleaseComObject(excelWorkSheet); //release COM-object to terminate processes
Marshal.ReleaseComObject(excelWorkbooks);
GC.Collect();
GC.WaitForPendingFinalizers();


这篇关于如何在excel中使用for循环填充excel中的数据库值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆