Ejemplo n.º 1
0
        public string InitExportData(ExportHead head, List <object> list, bool bsub = false, string subKey = "")
        {
            StringBuilder sbTitle = new StringBuilder();

            if (string.IsNullOrEmpty(head.HeadText))
            {
                sbTitle.Append("<tr>");
                sbTitle.Append(" <td style=\"font-size:16px; \" colspan=\"" + head.ThDataList.Count + "\"> <b> ");
                sbTitle.Append(head.HeadText);
                if (string.IsNullOrEmpty(head.SubHeadText))
                {
                    sbTitle.Append("<br/>" + head.SubHeadText);
                }
                sbTitle.Append(" </b> </td>");
                sbTitle.Append("</tr>");
            }
            sbTitle.Append("<tr>");
            foreach (string key in head.ThDataList.Keys)
            {
                sbTitle.Append(" <th  STYLE='MSO-NUMBER-FORMAT:\\@' >  ");
                sbTitle.Append(head.ThDataList[key].ToString());
                sbTitle.Append(" </th>");
            }
            sbTitle.Append("</tr>");

            foreach (object obj in list)
            {
                sbTitle.Append("<tr>");
                foreach (string key in head.ThDataList.Keys)
                {
                    sbTitle.Append(" <td " + (head.ThDataList[key].GetTypeInfo()) + " " + (bsub ? "color=\"#ff0000\"" : "") + " > ");
                    sbTitle.Append(getProperties(obj, key));
                    sbTitle.Append("  </td>");
                }
                sbTitle.Append("</tr>");
                if (bsub)
                {
                    //sbTitle.Append("<tr>");
                    ////sbTitle.Append(" <td STYLE='MSO-NUMBER-FORMAT:\\@'></td>");

                    //sbTitle.Append(" <td STYLE='MSO-NUMBER-FORMAT:\\@' >  </td>");

                    //sbTitle.Append("</tr>");
                    sbTitle.Append("[=" + getProperties(obj, subKey) + "]");
                }
            }
            return(sbTitle.ToString());
        }
Ejemplo n.º 2
0
 public string InnerExportDataHaveHaed(ExportHead head, List <object> list, bool bsub = false, string subKey = "")
 {
     return(ExcelHead().Replace("{0}", InitExportData(head, list, bsub, subKey))); //string.Format(, sbTitle.ToString());
 }