|
|
@@ -186,7 +186,7 @@ namespace UAS_LabelMachine
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
- int RowHeight = 11;
|
|
|
+ int RowHeight = 12;
|
|
|
/// <summary>
|
|
|
/// 将DataTable形式的数据转成Excel格式的,然后用字节流的形式写入文件
|
|
|
/// </summary>
|
|
|
@@ -278,22 +278,23 @@ namespace UAS_LabelMachine
|
|
|
HSSFWorkbook book = new HSSFWorkbook();
|
|
|
//Excel中的Sheet
|
|
|
ISheet sheet = book.CreateSheet("分页");
|
|
|
- sheet.SetMargin(MarginType.TopMargin, 0.5);
|
|
|
- sheet.SetMargin(MarginType.BottomMargin, 0.5);
|
|
|
- sheet.SetMargin(MarginType.LeftMargin, 0.5);
|
|
|
- sheet.SetMargin(MarginType.RightMargin, 0.5);
|
|
|
+ sheet.SetMargin(MarginType.TopMargin, 0.4);
|
|
|
+ sheet.SetMargin(MarginType.BottomMargin, 0.4);
|
|
|
+ sheet.SetMargin(MarginType.LeftMargin, 0.4);
|
|
|
+ sheet.SetMargin(MarginType.RightMargin, 0.4);
|
|
|
//芯片号需要作为更新盒号的条件
|
|
|
+ HSSFFont ffont = (HSSFFont)book.CreateFont();
|
|
|
+ ffont.FontName = "宋体";
|
|
|
bool ShowChcode = true;
|
|
|
//更新箱号
|
|
|
List<string> pib_id = new List<string>();
|
|
|
//系统打印箱号
|
|
|
List<string> pib_outboxcode1 = new List<string>();
|
|
|
-
|
|
|
int BoxCode = 1;
|
|
|
ICellStyle style = book.CreateCellStyle();
|
|
|
style.VerticalAlignment = VerticalAlignment.Center;
|
|
|
style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
|
|
|
-
|
|
|
+ style.SetFont(ffont);
|
|
|
ICellStyle styleborder = book.CreateCellStyle();
|
|
|
styleborder.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
styleborder.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
@@ -301,6 +302,7 @@ namespace UAS_LabelMachine
|
|
|
styleborder.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
|
|
|
styleborder.VerticalAlignment = VerticalAlignment.Center;
|
|
|
styleborder.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
|
|
|
+ styleborder.SetFont(ffont);
|
|
|
string pi_inoutno = "";
|
|
|
//设置列的宽度,根据首行的列的内容的长度来设置
|
|
|
for (int i = DataTable.Columns.Count - 1; i > 0; i--)
|
|
|
@@ -369,9 +371,12 @@ namespace UAS_LabelMachine
|
|
|
//固定第一行
|
|
|
//row.RowStyle.IsLocked=true;
|
|
|
//给第一行的标签赋值样式和值
|
|
|
+ // ffont.FontHeight = 13;
|
|
|
row.CreateCell(0);
|
|
|
- row.Cells[0].SetCellValue(" 深爱半导体股份有限公司芯片出货清单");
|
|
|
- row.GetCell(0).CellStyle = style;
|
|
|
+ row.Cells[0].SetCellValue(" 深爱半导体股份有限公司芯片出货清单");
|
|
|
+
|
|
|
+ row.GetCell(0).CellStyle.SetFont((ffont));
|
|
|
+ //ffont.FontHeight = 10;
|
|
|
//开始绘制的Index
|
|
|
int PaintIndex = 1;
|
|
|
int sumCount = 0;
|
|
|
@@ -464,7 +469,7 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_title"].ToString());
|
|
|
}
|
|
|
- else if (j > 5 && j == columnNum - 5)
|
|
|
+ else if (j == 4)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
|
|
|
@@ -490,7 +495,7 @@ namespace UAS_LabelMachine
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
|
|
|
}
|
|
|
- else if (columnNum > 5 && j == columnNum - 5)
|
|
|
+ else if (j == 4)
|
|
|
{
|
|
|
row1.CreateCell(j);
|
|
|
row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
|
|
|
@@ -622,7 +627,7 @@ namespace UAS_LabelMachine
|
|
|
row1.Cells[j].CellStyle = style;
|
|
|
}
|
|
|
sheet.SetRowBreak(PaintIndex);
|
|
|
- sheet.Footer.Center ="第&P页,共&N页";
|
|
|
+ sheet.Footer.Center = "第&P页,共&N页";
|
|
|
PaintIndex = PaintIndex + 1;
|
|
|
}
|
|
|
pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
|
|
|
@@ -1035,7 +1040,7 @@ namespace UAS_LabelMachine
|
|
|
ISheet sheet2 = book.CreateSheet("首页");
|
|
|
row = sheet2.CreateRow(0);
|
|
|
row.CreateCell(0);
|
|
|
- row.Cells[0].SetCellValue(" 深爱半导体股份有限公司芯片出货清单");
|
|
|
+ row.Cells[0].SetCellValue(" 深爱半导体股份有限公司芯片出货清单");
|
|
|
row.GetCell(0).CellStyle = style;
|
|
|
rowNum = FirstDT.Rows.Count;
|
|
|
//不需要显示的列移除
|