Пример #1
0
        public ExcelXmlModel GetUploadExcelXMLConfig(string xmlFilePath, string menuid)
        {
            ExcelXmlModel output = new ExcelXmlModel();

            string  excel_menu = "..excel_" + menuid;
            JObject jObject    = BI_Project.Helpers.Utility.JTokenHelper.GetXML2Jobject(xmlFilePath);

            output.TemplateContents = BI_Project.Helpers.Utility.JTokenHelper.GetActiveJObject(jObject, excel_menu);
            //Get Common Info
            output.ExcelXmlCommon = new ExcelXmlCommon();
            output.ExcelXmlCommon.ExcelFileName = BI_Project.Helpers.Utility.JTokenHelper.GetElementLanguage(jObject,
                                                                                                             excel_menu + ".common.filename");

            output.ExcelXmlCommon.SheetName = BI_Project.Helpers.Utility.JTokenHelper.GetElementLanguage(jObject,
                                                                                                         excel_menu + ".common.sheet");

            output.ExcelXmlCommon.StartRow = int.Parse(BI_Project.Helpers.Utility.JTokenHelper.GetElementLanguage(jObject,
                                                                                                                  excel_menu + ".common.datarowstart"));

            output.ExcelXmlCommon.ReportName = BI_Project.Helpers.Utility.JTokenHelper.GetElementLanguage(jObject,
                                                                                                          excel_menu + ".common.reportname");

            output.ExcelXmlCommon.exportDirectory = BI_Project.Helpers.Utility.JTokenHelper.GetElementLanguage(jObject,
                                                                                                               excel_menu + ".common.exportDirectory");
            //GET PARAMETERS
            IEnumerable <JToken> paras = BI_Project.Helpers.Utility.JTokenHelper.GetList(jObject, excel_menu + "..paras.para");
            int index = 0;

            foreach (JToken para in paras)
            {
                //XMLParaModel
                ExcelXMLPara paraXMLModel = new ExcelXMLPara();
                paraXMLModel.Name    = para.SelectToken("..name").Value <string>();
                paraXMLModel.Row     = para.SelectToken("..row").Value <Int32>();
                paraXMLModel.Column  = para.SelectToken("..column").Value <Int32>();
                paraXMLModel.Colspan = para.SelectToken("..colspan").Value <Int32>();
                paraXMLModel.Title   = para.SelectToken("..title").Value <string>();

                output.LstParas.Add(paraXMLModel);
            }

            //GET COLUMNS CONFIG
            IEnumerable <JToken> columns = BI_Project.Helpers.Utility.JTokenHelper.GetList(jObject, excel_menu + "..columns.column");

            foreach (JToken column in columns)
            {
                ExcelXMLColumn columnXML = new ExcelXMLColumn();
                columnXML.Name        = column.SelectToken("..name").Value <string>();
                columnXML.Title       = column.SelectToken("..title").Value <string>();
                columnXML.DataType    = column.SelectToken("..datatype").Value <string>();
                columnXML.IsGetData   = column.SelectToken("..isgetdata").Value <bool>();
                columnXML.ColumnWidth = column.SelectToken("..width").Value <int>();
                output.LstColumn.Add(columnXML);
            }
            return(output);
        }
Пример #2
0
 public void writePara(ExcelWorksheet worksheet, ExcelXMLPara para, bool isBold)
 {
     writeHeaderColumn(worksheet, para.Row, para.Column, para.Colspan, para.Title, isBold, 0);
 }