示例#1
0
        public int toSheet(C2017sum item, Excel.Worksheet thisWorkSheet, int curRow, int incRow)
        {
            thisWorkSheet.Cells[2, 2] = item.机构;
            thisWorkSheet.Cells[3, 2] = item.姓名;
            thisWorkSheet.Cells[3, 4] = item.职工号;
            thisWorkSheet.Cells[4, 2] = item.身份证号码;
            thisWorkSheet.Cells[7, 1] = item.年合计收入;
            thisWorkSheet.Cells[7, 2] = item.工资;
            thisWorkSheet.Cells[7, 3] = item.奖金;
            thisWorkSheet.Cells[7, 4] = item.奖励性补贴;

            string srcStr   = "1:9";
            var    srcSheet = thisWorkSheet.Range[srcStr];

            curRow = curRow + incRow;

            string dstStr   = $"{curRow}:{curRow + incRow - 1}";
            var    dstSheet = thisWorkSheet.Range[dstStr];

            WriteLine($"src:{srcStr}, dst:{dstStr}");

            srcSheet.Copy(dstSheet);

            return(curRow);
        }
示例#2
0
        public int toSheet2(C2017sum item, Excel.Worksheet thisWorkSheet, int curRow, int incRow, int itemCount, int itemPerPage)
        {
            thisWorkSheet.Cells[2, 2] = item.机构;
            thisWorkSheet.Cells[3, 2] = item.姓名;
            thisWorkSheet.Cells[3, 4] = item.职工号;
            thisWorkSheet.Cells[4, 2] = item.身份证号码;
            thisWorkSheet.Cells[7, 1] = item.年合计收入;
            thisWorkSheet.Cells[7, 2] = item.工资;
            thisWorkSheet.Cells[7, 3] = item.奖金;
            thisWorkSheet.Cells[7, 4] = item.奖励性补贴;

            string srcStr   = "1:9";
            var    srcSheet = thisWorkSheet.Range[srcStr];

            curRow = curRow + incRow * itemPerPage;

            if (curRow >= (itemCount + 1) * incRow + 1)
            {
                int pageNum = curRow / (incRow * itemPerPage);
                WriteLine($"分页:{pageNum}");
                curRow = curRow - pageNum * itemPerPage * incRow + incRow;
            }

            string dstStr = $"{curRow}:{curRow + incRow - 1}";

            WriteLine($"src:{srcStr}, dst:{dstStr}");

            var dstSheet = thisWorkSheet.Range[dstStr];

            srcSheet.Copy(dstSheet);

            return(curRow);
        }