通用Excel模板下载(依据表单明细列自动生成,包含下拉值)

master
xiaochanghai 5 months ago
parent ad4286710d
commit a28259bace
  1. 21
      Tiobon.Core.DataAccess/ReportHelper.cs

@ -166,13 +166,11 @@ public static class ReportHelper
if (rowIndex == 655350 || rowIndex == 0)
{
if (rowIndex != 0)
{
sheet = workbook.CreateSheet();
}
intTop = 0;
#region 列头及样式
{
IRow headerRow = sheet.CreateRow(intTop);
headerRow.HeightInPoints = HeightInPoints;
intTop += 1;
@ -210,15 +208,8 @@ public static class ReportHelper
font2.FontName = "宋体";
font2.Color = IndexedColors.Red.Index;
headRequiredStyle.SetFont(font2);
#endregion
//ICellStyle headStyle = workbook.CreateCellStyle();
//headStyle.Alignment = HorizontalAlignment.Center;
//headStyle.BorderBottom = BorderStyle.Medium;
//headStyle.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.LightGreen.Index;
//headStyle.FillPattern = FillPattern.NoFill;
//IFont font = workbook.CreateFont();
//font.Boldweight = 700;
//headStyle.SetFont(font);
for (int j = 0; j < tableColumn.Count; j++)
{
string dataSource = tableColumn[j].dataSource;
@ -286,17 +277,13 @@ public static class ReportHelper
}
}
#endregion
rowIndex = intTop;
}
#endregion
#region 填充内容
IRow dataRow = sheet.CreateRow(rowIndex);
dataRow.HeightInPoints = 25;
//IRow dataRow = sheet.CreateRow(rowIndex);
//dataRow.HeightInPoints = 25;
ICellStyle style = workbook.CreateCellStyle();
style.Alignment = HorizontalAlignment.Center; //居中

Loading…
Cancel
Save