📄 table5.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using AnotherPDFLib.Forms;
namespace AnotherPDFLibTest
{
public class Table5 : AppendentTable
{
public Table5()
{
Name = "table5";
Title = "表5 协作研究支出预算明细表";
SubTitle = "(申请市科委科研计划项目课题资助经费在20万元人民币及以下时,毋须填写本表)";
Remarks =
@"本表(5)列累计数=“上海市科研计划项目资助课题经费预算表”中“其中:申请本次资助额”列相关数字。";
ColumnCaptions = new string[]
{
"协作研究任务名称",
"协作研究任务内容",
"协作研究任务承担单位",
"总价",
"其中:申请本次资助额"
};
ColumnNumbers = new string[]
{
"(1)",
"(2)",
"(3)",
"(4)",
"(5)"
};
FieldNames = new string[]{
"N:orderNum",
"T:taskName",
"T:taskDesc",
"T:taskTaker",
"N:totalPrice",
"N:applyNum"
};
footNames = new string[]{
"priceSum",
"applySum"
};
}
public override Table[] BuildTable()
{
string[][] columnHeaders = new string[][] { ColumnCaptions, ColumnNumbers };
Table tablehead = CreateTableHeader(columnHeaders);
tablehead.Cells[0][3].Width = tablehead.Cells[0][4].Width * 0.8F;
tablehead.CalculateSize();
if (tablehead.Width < TableWidth)
{
tablehead.SetWidth(TableWidth);
}
Table headRow = new Table(1, 2);
headRow.Cells[0][0] = CreateLabel("序号");
headRow.Cells[0][1] = tablehead;
headRow.Name = "headRow";
List<float> widths = new List<float>();
widths.Add(headRow.ColumnWidths[0]);
widths.AddRange(tablehead.ColumnWidths);
float paddingLeft, paddingRight;
Table inputRow = CreateInputRow(FieldNames, widths, out paddingLeft, out paddingRight);
inputRow.Name = "inputRow";
inputRow.Occurance.Inintial = InitialRows;
SetCalculateScript((NumerictBox)inputRow["orderNum"], new JavaScript(@"
if(inputRow.index == 0){
var tableIndex = 0;
if(inputRow.parent != null){
tableIndex = inputRow.parent.parent.index;
}
this.rawValue=tableIndex * 10 + 1;
}else{
this.rawValue=inputRow.all.item(inputRow.index-1).orderNum.rawValue+1;
}
".Replace("table2", Name)
));
NumerictBox totalPrice = (NumerictBox)inputRow["totalPrice"];
totalPrice.DataType = typeof(decimal);
totalPrice.RadixAlign = 30;
totalPrice.Event.Validate = new FormCalc(@"
totalPrice >= applyNum");
totalPrice.Event.ValidateMessage = "总价必须≥其中:申请本次资助额的金额。";
NumerictBox applyNum = (NumerictBox)inputRow["applyNum"];
applyNum.DataType = typeof(decimal);
applyNum.RadixAlign = 30;
applyNum.InitialValue = "0";
Table footRow = CreateFootRow(4, footNames, widths);
footRow.Name = "footRow";
SetCalculateScript((NumerictBox)footRow["priceSum"], new FormCalc(@"
Sum(table2[*].inputRow[*].totalPrice)".Replace("table2", Name)
));
SetCalculateScript((NumerictBox)footRow["applySum"], new FormCalc(@"
Sum(table2[*].inputRow[*].applyNum)".Replace("table2", Name)
));
NumerictBox priceSum = (NumerictBox)footRow["priceSum"];
priceSum.DataType = typeof(decimal);
priceSum.RadixAlign = 30;
NumerictBox applySum = (NumerictBox)footRow["applySum"];
applySum.DataType = typeof(decimal);
applySum.RadixAlign = 30;
headRow.Padding.Left = paddingLeft;
footRow.Padding.Left = paddingLeft;
headRow.Padding.Right = paddingRight;
footRow.Padding.Right = paddingRight;
return new Table[] { headRow, inputRow, footRow };
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -