using gregn6Lib;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MasaBlazorApp3.Report
{
    public class GridReportUtil
    {

        // 定义Grid++Report报表主对象
        public static GridppReport Report = new GridppReport();
        /**
         * 打印预览
         * tempname: 模板文件名称
         * data: 模板数据
         */
        public static void PrintReport(string tempname, object data)
        {
            // 定义Grid++Report报表主对象
            // 加载模板文件
            Report.LoadFromFile(new FileInfo(AppDomain.CurrentDomain.BaseDirectory) + "ReportTemp//" + tempname);
            string s = JsonConvert.SerializeObject(data);
            // 加载数据
            Report.LoadDataFromXML(JsonConvert.SerializeObject(data));
            Report.PrintPreview(true);
        }
    }
}
