rivate void bntPrint_Click(object sender, System.EventArgs e)
{
try
{
ProcessExcelTemplate oReport = new ProcessExcelTemplate();
oReport.ReportTemplate = Server.MapPath("../../Report/ForestCover.xls");
oReport.ReportName ="ヒユヨンハミノュチヨクイクヌヌ鯀・;
oReport.TotalReportIndex=1;
oReport.ProcessFileFirst();
oReport.ReportIndex=1;
oReport.ProcessActiveSheet();
oReport.ProcessName("ヒユヨンハミノュチヨヌ鯀イクヌア・); int row=0;
int col=0; oReport.ProcessFileMain("2","A","ト・ン");
oReport.ProcessFileMain("2","B",txtYear.Text);
for(int i=0;i<gridFC.Rows.Count;i++)
for(int j=1;j<gridFC.Columns.Count;j++)
{
row=i+7;
col=64+j;
oReport.ProcessFileMain(row.ToString(),((char)col).ToString(),gridFC.Rows[i].Cells[j].Text);
}
oReport.ProcessFileLast();
}
catch(Exception E)
{
WebCommon.ExceptionMessage(E);
}
}
{
try
{
ProcessExcelTemplate oReport = new ProcessExcelTemplate();
oReport.ReportTemplate = Server.MapPath("../../Report/ForestCover.xls");
oReport.ReportName ="ヒユヨンハミノュチヨクイクヌヌ鯀・;
oReport.TotalReportIndex=1;
oReport.ProcessFileFirst();
oReport.ReportIndex=1;
oReport.ProcessActiveSheet();
oReport.ProcessName("ヒユヨンハミノュチヨヌ鯀イクヌア・); int row=0;
int col=0; oReport.ProcessFileMain("2","A","ト・ン");
oReport.ProcessFileMain("2","B",txtYear.Text);
for(int i=0;i<gridFC.Rows.Count;i++)
for(int j=1;j<gridFC.Columns.Count;j++)
{
row=i+7;
col=64+j;
oReport.ProcessFileMain(row.ToString(),((char)col).ToString(),gridFC.Rows[i].Cells[j].Text);
}
oReport.ProcessFileLast();
}
catch(Exception E)
{
WebCommon.ExceptionMessage(E);
}
}
OleDbConnection myConn = new OleDbConnection(strCon);
string strCom = " SELECT * FROM [Sheet1$]";
myConn.Open();
OleDbDataAdapter myCommand = new OleDbDataAdapter(strCom, myConn);
dataSet_ = new DataSet("Sheet1");
myCommand.Fill(dataSet_, "Sheet1");
myConn.Close();
就可以了.
如果第一个表名不是Sheet1的时候,会出错哦