我是Devexpress的新手。我现在需要使用Flexcel技术进行报告。
我的要求包括:
这是我的样本。它运行但数据无法显示。我使用“documentViewer”来查看:
using DevExpress.XtraEditors;
using FlexCel.Core;
using FlexCel.Report;
using FlexCel.XlsAdapter;
public partial class frmPrintSample : DevExpress.XtraEditors.XtraForm
{
public frmPrintSample()
{
InitializeComponent();
this.documentViewer1.DocumentSource= CreateReport();
}
public ExcelFile CreateReport()
{
FlexCelReport flexcelreport = new FlexCelReport();
DataTable dt = new DataTable();
//dt = GetfromToDataTable();
flexcelreport.AddTable("Datatable", dt);
ExcelFile rs = Run_templatereport(flexcelreport);
return rs;
}
private ExcelFile Run_templatereport(FlexCelReport flexcelreport)
{
object misValue = System.Reflection.Missing.Value;
string filename = @"E:\Samplate.xlsx";
if (!File.Exists(filename))
{
throw new Exception("Template Report is not exist!");
return null;
}
ExcelFile result = new XlsFile(filename);
flexcelreport.Run(result);
return result;
}
}