如何在asp.net mvc中将devexpress报告导出为pdf?

时间:2018-01-26 06:35:23

标签: c# asp.net-mvc asp.net-mvc-4 devexpress devexpress-mvc

public ActionResult PrintReprtForSpecicDates(DateTime startdate, DateTime enddate)
    {
        string path = Server.MapPath("~/Reports/myreport.html");
        ViewBag.SpecificReport = path;
        using (ProDbDataContext _Context = new ProDbDataContext())
        {
            List<Sp_GetSpecificRecordResult> RecordList = _Context.Sp_GetSpecificRecord(startdate,enddate).ToList();
            foreach (var item in RecordList)
            {
                item.ImagePath = "/ProductsImages/" + item.ImagePath;
            }
            var dt = Helper.Helper.ToDataTable(RecordList);
            RptGetSpecificRecords reportobj = new RptGetSpecificRecords();
            reportobj.DataSource = dt;
            reportobj.Parameters["Startdate"].Value = Convert.ToDateTime(startdate).ToShortDateString();
            reportobj.Parameters["Enddate"].Value = Convert.ToDateTime(enddate).ToShortDateString();
            reportobj.ExportToPdf(path);
        }

        return View();
    }
  

接下来我该怎么办?我已导出到HTML但现在想导出到pdf指导我下一步怎么做?

1 个答案:

答案 0 :(得分:0)

if($xml_report_abbrev_bb){
    echo $xml_report_abbrev_bb[0]->INTELL->CONTYPE;
    echo $xml_report_abbrev_bb[0]['termId'].'<br>';

    $surveyId = $xml_report_abbrev_bb[0]->attributes(('http://www.digitalmeasures.com/schema/data-metadata'))['surveyId'];
    echo 'surveyId is...<h1>'.$surveyId.'</h1><br>';  // <h1>12</h1>

} else {
    echo 'XPath query failed';  
}