using System;
using System.Data;
using Lee.Library.Reports.Office.Excel;
namespace Lee.Sample.Reports.Office.Excel
{
public class SampleReport : BaseReport
{
public SampleReport(DataSet ds) : base(ds) { }
protected override void InitReport()
{
this.ReportName = @"UserInfo";
this.ReportSavePath = AppDomain.CurrentDomain.BaseDirectory + @"ReportsOfficeExcel";
this.Excel = new WorkBook(AppDomain.CurrentDomain.BaseDirectory + @"ReportsOfficeExcelUserInfo.xls", "UserInfo");
this.Excel.Sheets.Add(new WorkSheet("MyUserInfo"));
for (int i = 0; i < this.DataSource.Tables[0].Rows.Count; i++)
{
DataRow dr = this.DataSource.Tables[0].Rows[i];
this.Excel.Sheets[0].Add(new WorkCell("B" + (i + 3).ToString(), dr.Field("ID")));
this.Excel.Sheets[0].Add(new WorkCell("C" + (i + 3).ToString(), dr.Field("NAME")));
}
}
}
}
|