/// <summary> /// 是否导出多级表头 /// </summary> /// <param name="gridDt"></param> /// <param name="isExportTemplate"></param> /// <returns></returns> private static bool ExportMulHeader(MDataTable gridDt, bool isExportTemplate) { MDataTable dt = gridDt.FindAll(isExportTemplate ? "Import=1" : "Export=1"); return(dt.Max <int>("MergeIndexed") != dt.Min <int>("MergeIndexed")); #region 原来逻辑 /* * bool ifHidden = false, ifImport = false, ifExport = false, ifRowspan = false, ifColspan = false, ifMergeIndexed = false; * for (int i = 1; i < gridDt.Rows.Count; i++) * { * ifHidden = gridDt.Rows[i].Get<bool>("Hidden"); * ifImport = gridDt.Rows[i].Get<bool>("Import"); * ifExport = gridDt.Rows[i].Get<bool>("Export"); * ifRowspan = gridDt.Rows[i].Get<bool>("Rowspan"); * ifColspan = gridDt.Rows[i].Get<bool>("Colspan"); * ifMergeIndexed = gridDt.Rows[i].Get<bool>("MergeIndexed"); * if (isExportTemplate)//导出模版 * { * if (ifHidden && !ifImport) * { * if (ifRowspan && ifColspan && ifMergeIndexed) * { * continue; * } * else * { * return false; * } * } * } * else//导出数据 * { * if (ifHidden && !ifExport) * { * if (ifRowspan && ifColspan && ifMergeIndexed) * { * continue; * } * else * { * return false; * } * } * } * } * return true; */ #endregion }