當前位置: 首頁>>代碼示例>>C#>>正文


C# Table.addCell方法代碼示例

本文整理匯總了C#中iTextSharp.text.Table.addCell方法的典型用法代碼示例。如果您正苦於以下問題:C# Table.addCell方法的具體用法?C# Table.addCell怎麽用?C# Table.addCell使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在iTextSharp.text.Table的用法示例。


在下文中一共展示了Table.addCell方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: btnProfitReport_Click


//.........這裏部分代碼省略.........
            string filePath = Server.MapPath("../../Config/");

            string[] fileArray = Directory.GetFiles(filePath, "*.pdf");
            foreach (string file in fileArray)
            {
                File.Delete(file);
            }
            Document document = new Document(PageSize.A4, 15, 15, 10, 10);

            try
            {
                PdfWriter.getInstance(document, new FileStream(filePath + fileName + ".pdf", FileMode.Create));

                document.Header = PdfHelper.GetHeardFooter("億度物流", SettingOperation.LoadSetting().Phone);

                document.Open();

                Paragraph phTitle = new Paragraph(new Chunk("利潤分析表", PdfHelper.fontTitle));
                phTitle.Alignment = Element.ALIGN_CENTER;

                Paragraph phTitle2 = new Paragraph(new Chunk(titleContent, PdfHelper.fontHeader));
                phTitle2.Alignment = Element.ALIGN_LEFT;

                document.Add(phTitle);
                document.Add(phTitle2);

                iTextSharp.text.Table tblContent = new iTextSharp.text.Table(12);
                tblContent.setWidths(new int[] { 15, 10, 8, 8, 8 , 8, 9, 7, 7, 7, 7, 11 });
                tblContent.WidthPercentage = 99;
                tblContent.Border = 0;
                tblContent.Cellpadding = 1;
                tblContent.Cellspacing = 1;

                tblContent.addCell(PdfHelper.GetTitleCellLeft("收件單號"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("收件日期"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("客戶姓名"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("業務員"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("承運商"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("單號"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("國家"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("重量"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("數量"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("收入"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("成本"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("利潤金額"));

                int totalCount = 0;
                decimal totalIncome = 0;
                decimal totalCost = 0;
                decimal totalProfit = 0;

                foreach (SearchOrderDetail sod in result)
                {
                    tblContent.addCell(PdfHelper.GetCellLeft(sod.OrderEncode));
                    tblContent.addCell(PdfHelper.GetCellLeft(OrderOperation.GetOrderByEncode(sod.OrderEncode).ReceiveDate.ToShortDateString()));
                    tblContent.addCell(PdfHelper.GetCellLeft(sod.Client.RealName));
                    tblContent.addCell(PdfHelper.GetCellLeft(UserOperation.GetUserById(OrderOperation.GetOrderByEncode(sod.OrderEncode).UserId).RealName));
                    tblContent.addCell(PdfHelper.GetCellLeft(sod.CarrierEncode));
                    tblContent.addCell(PdfHelper.GetCellLeft(sod.BarCode));
                    tblContent.addCell(PdfHelper.GetCellLeft(sod.ToCountry));
                    tblContent.addCell(PdfHelper.GetCellRight(sod.Weight.ToString()));
                    tblContent.addCell(PdfHelper.GetCellRight(sod.Count.ToString()));
                    tblContent.addCell(PdfHelper.GetCellRight(sod.TotalCosts.ToString()));
                    tblContent.addCell(PdfHelper.GetCellRight(sod.SelfTotalCosts.ToString()));
                    tblContent.addCell(PdfHelper.GetCellRight((sod.TotalCosts - sod.SelfTotalCosts).ToString()));
開發者ID:sd1362168638,項目名稱:XSEMS,代碼行數:66,代碼來源:AssessReport.aspx.cs

示例2: btnUserReport_Click


//.........這裏部分代碼省略.........
            string filePath = Server.MapPath("../../Config/");

            string[] fileArray = Directory.GetFiles(filePath, "*.pdf");
            foreach (string file in fileArray)
            {
                File.Delete(file);
            }
            Document document = new Document(PageSize.A4, 15, 15, 10, 10);

            try
            {
                PdfWriter.getInstance(document, new FileStream(filePath + fileName + ".pdf", FileMode.Create));

                document.Header = PdfHelper.GetHeardFooter("億度物流", SettingOperation.LoadSetting().Phone);

                document.Open();

                Paragraph phTitle = new Paragraph(new Chunk("業務員考核表", PdfHelper.fontTitle));
                phTitle.Alignment = Element.ALIGN_CENTER;

                Paragraph phTitle2 = new Paragraph(new Chunk(titleContent, PdfHelper.fontHeader));
                phTitle2.Alignment = Element.ALIGN_LEFT;

                document.Add(phTitle);
                document.Add(phTitle2);

                iTextSharp.text.Table tblContent = new iTextSharp.text.Table(4);
                tblContent.setWidths(new int[] { 30, 30, 20, 20 });
                tblContent.WidthPercentage = 99;
                tblContent.Border = 0;
                tblContent.Cellpadding = 1;
                tblContent.Cellspacing = 1;

                tblContent.addCell(PdfHelper.GetTitleCellLeft("所屬公司"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("所屬部門"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("業務員"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("金額"));

                decimal totalMoney = 0;
                foreach (UserSales us in result)
                {
                    tblContent.addCell(PdfHelper.GetCellLeft(CompanyOperation.GetCompanyById(us.User.CompanyId).Name));
                    tblContent.addCell(PdfHelper.GetCellLeft(DepartmentOperation.GetDepartmentById(us.User.DepartmentId).Name));
                    tblContent.addCell(PdfHelper.GetCellLeft(us.User.RealName));
                    tblContent.addCell(PdfHelper.GetCellRight(us.Money.ToString()));

                    totalMoney += us.Money;
                }

                tblContent.addCell(PdfHelper.GetCellLeft(""));
                tblContent.addCell(PdfHelper.GetCellLeft(""));
                tblContent.addCell(PdfHelper.GetCellLeft(""));
                tblContent.addCell(PdfHelper.GetCellLeft(""));

                tblContent.addCell(PdfHelper.GetFooterCellLeft("合計:"));
                tblContent.addCell(PdfHelper.GetFooterCellRight(""));
                tblContent.addCell(PdfHelper.GetFooterCellRight(""));
                tblContent.addCell(PdfHelper.GetFooterCellRight(totalMoney.ToString()));

                document.Add(tblContent);

                document.resetHeader();
            }
            catch (Exception ex)
            {
                lblMsg.Text = "生成PDF文件出錯," + ex.ToString();
開發者ID:sd1362168638,項目名稱:XSEMS,代碼行數:67,代碼來源:AssessReport.aspx.cs

示例3: btnArDetailStatistic_Click


//.........這裏部分代碼省略.........
            string filePath = Server.MapPath("../../Config/");

            string[] fileArray = Directory.GetFiles(filePath, "*.pdf");
            foreach (string file in fileArray)
            {
                File.Delete(file);
            }
            Document document = new Document(PageSize.A4, 15, 15, 10, 10);

            try
            {
                PdfWriter.getInstance(document, new FileStream(filePath + fileName + ".pdf", FileMode.Create));

                document.Header = PdfHelper.GetHeardFooter("億度物流", SettingOperation.LoadSetting().Phone);

                document.Open();

                Paragraph phTitle = new Paragraph(new Chunk("已收款明細", PdfHelper.fontTitle));
                phTitle.Alignment = Element.ALIGN_CENTER;

                Paragraph phTitle2 = new Paragraph(new Chunk(titleContent, PdfHelper.fontHeader));
                phTitle2.Alignment = Element.ALIGN_LEFT;

                document.Add(phTitle);
                document.Add(phTitle2);

                iTextSharp.text.Table tblContent = new iTextSharp.text.Table(7);
                tblContent.setWidths(new int[] { 18, 15, 10, 15, 14, 14, 14 });
                tblContent.WidthPercentage = 99;
                tblContent.Border = 0;
                tblContent.Cellpadding = 1;
                tblContent.Cellspacing = 1;

                tblContent.addCell(PdfHelper.GetTitleCellLeft("所屬公司"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("收款單號"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("收款日期"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("發票號碼"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("付款方式"));
                tblContent.addCell(PdfHelper.GetTitleCellLeft("經手人"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("收款金額"));
                foreach (ClientRecharge cr in result)
                {
                    Cell cellClientName = new Cell(new Paragraph("客戶姓名: " + cr.Client.RealName, PdfHelper.fontContent));
                    cellClientName.Colspan = 7;
                    cellClientName.HorizontalAlignment = Element.ALIGN_LEFT;
                    cellClientName.VerticalAlignment = Element.ALIGN_MIDDLE;
                    tblContent.addCell(cellClientName);

                    decimal totalMoney = 0;
                    foreach (Recharge recharge in cr.RechargeList)
                    {
                        tblContent.addCell(PdfHelper.GetCellLeft(CompanyOperation.GetCompanyById(recharge.CompanyId).Name));
                        tblContent.addCell(PdfHelper.GetCellLeft(recharge.Encode));
                        tblContent.addCell(PdfHelper.GetCellLeft(recharge.ReceiveTime.ToShortDateString()));
                        tblContent.addCell(PdfHelper.GetCellLeft(recharge.Invoice));
                        tblContent.addCell(PdfHelper.GetCellLeft(recharge.PaymentMethodName));
                        tblContent.addCell(PdfHelper.GetCellLeft(recharge.UserName));
                        tblContent.addCell(PdfHelper.GetCellRight(recharge.Money.ToString()));

                        totalMoney += recharge.Money;
                    }

                    tblContent.addCell(PdfHelper.GetFooterCellLeft("合計:"));
                    tblContent.addCell(PdfHelper.GetFooterCellRight(""));
                    tblContent.addCell(PdfHelper.GetFooterCellRight(""));
                    tblContent.addCell(PdfHelper.GetFooterCellRight(""));
開發者ID:sd1362168638,項目名稱:XSEMS,代碼行數:67,代碼來源:AlreadyReceivedReport.aspx.cs

示例4: btnClientStatistic_Click


//.........這裏部分代碼省略.........
            string filePath = Server.MapPath("../../Config/");

            string[] fileArray = Directory.GetFiles(filePath, "*.pdf");
            foreach (string file in fileArray)
            {
                File.Delete(file);
            }
            Document document = new Document(PageSize.A4, 15, 15, 10, 10);

            try
            {
                PdfWriter.getInstance(document, new FileStream(filePath + fileName + ".pdf", FileMode.Create));

                document.Header = PdfHelper.GetHeardFooter("億度物流", SettingOperation.LoadSetting().Phone);

                document.Open();

                Paragraph phTitle = new Paragraph(new Chunk("客戶統計表", PdfHelper.fontTitle));
                phTitle.Alignment = Element.ALIGN_CENTER;

                Paragraph phTitle2 = new Paragraph(new Chunk(titleContent, PdfHelper.fontHeader));
                phTitle2.Alignment = Element.ALIGN_LEFT;

                document.Add(phTitle);
                document.Add(phTitle2);

                iTextSharp.text.Table tblContent = new iTextSharp.text.Table(8);
                tblContent.setWidths(new int[] { 13, 8, 13, 15, 15, 16, 10, 10 });
                tblContent.WidthPercentage = 99;
                tblContent.Border = 0;
                tblContent.Cellpadding = 1;
                tblContent.Cellspacing = 1;

                tblContent.addCell(PdfHelper.GetTitleCellLeft("客戶姓名"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("編號"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("用戶名"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("地區"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("手機"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("郵箱"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("餘額"));
                tblContent.addCell(PdfHelper.GetTitleCellRight("信用額度"));

                foreach (Client client in result)
                {
                    tblContent.addCell(PdfHelper.GetCellLeft(client.RealName));
                    tblContent.addCell(PdfHelper.GetCellRight(client.Id.ToString()));
                    tblContent.addCell(PdfHelper.GetCellRight(client.Username));
                    tblContent.addCell(PdfHelper.GetCellRight(client.Province + " " + client.City));
                    tblContent.addCell(PdfHelper.GetCellRight(client.Mobile));
                    tblContent.addCell(PdfHelper.GetCellRight(client.Email));
                    tblContent.addCell(PdfHelper.GetCellRight(client.Balance.ToString()));
                    tblContent.addCell(PdfHelper.GetCellRight(client.Credit.ToString()));
                }

                document.Add(tblContent);

                document.resetHeader();
            }
            catch (Exception ex)
            {
                lblMsg.Text = "生成PDF文件出錯," + ex.ToString();
            }
            finally
            {
                document.Close();
            }
開發者ID:sd1362168638,項目名稱:XSEMS,代碼行數:67,代碼來源:ClientStatistics.aspx.cs

示例5: btnPrintPost_Click

    protected void btnPrintPost_Click(object sender, EventArgs e)
    {
        DateTime receiveDate = new DateTime(1999, 1, 1);
        if (string.IsNullOrEmpty(Request.Form[txtReceivedDate.ID].Trim()) || !DateTime.TryParse(Request.Form[txtReceivedDate.ID].Trim(), out receiveDate))
        {
            lblMsg.Text = "如果貨物已經收到請先填寫收件日期!";
            return;
        }
        if (order.CreateUser == null)
        {
            order.ReceiveDate = receiveDate;
            order.UserId = user.Id;
            order.CreateUser = user;
            OrderOperation.UpdateOrder(order);
        }

        string fileName = StringHelper.GetEncodeNumber("HYD");
        string filePath = Server.MapPath("../../Config/");

        string[] fileArray = Directory.GetFiles(filePath, "*.pdf");
        foreach (string file in fileArray)
        {
            File.Delete(file);
        }
        Document document = new Document(PageSize.A4, 15, 15, 10, 10);

        try
        {
            Company company = CompanyOperation.GetCompanyById(user.CompanyId);

            PdfWriter.getInstance(document, new FileStream(filePath + fileName + ".pdf", FileMode.Create));

            document.Header = PdfHelper.GetHeardFooter("億度物流", company.Phone);

            document.Open();

            Paragraph phTitle = new Paragraph(new Chunk("貨運單", PdfHelper.fontTitle));
            phTitle.Alignment = Element.ALIGN_CENTER;

            document.Add(phTitle);

            iTextSharp.text.Table tblTitle = new iTextSharp.text.Table(4);
            tblTitle.setWidths(new int[] { 15, 35, 15, 35 });
            tblTitle.WidthPercentage = 99;
            tblTitle.Border = 0;
            tblTitle.Cellpadding = 1;
            tblTitle.Cellspacing = 1;

            tblTitle.addCell(PdfHelper.GetCellRight("收件單號:"));
            tblTitle.addCell(PdfHelper.GetCellLeft(" " + order.Encode));
            tblTitle.addCell(PdfHelper.GetCellRight("收件日期:"));
            tblTitle.addCell(PdfHelper.GetCellLeft(" " + order.ReceiveDate.ToShortDateString()));
            tblTitle.addCell(PdfHelper.GetCellRight("收件方式:"));
            tblTitle.addCell(PdfHelper.GetCellLeft(" " + order.ReceiveType));
            tblTitle.addCell(PdfHelper.GetCellRight("收件網點:"));
            tblTitle.addCell(PdfHelper.GetCellLeft(" " + order.CompanyName));
            tblTitle.addCell(PdfHelper.GetCellRight("客戶姓名:"));
            tblTitle.addCell(PdfHelper.GetCellLeft(" " + order.Client.RealName));
            tblTitle.addCell(PdfHelper.GetCellRight("業 務 員:"));
            tblTitle.addCell(PdfHelper.GetCellLeft(" " + UserOperation.GetUserById(order.UserId).RealName));
            tblTitle.addCell(PdfHelper.GetCellRight("備    注:"));

            Cell bzCellValue = new Cell(new Paragraph(" " + order.Remark, PdfHelper.fontContent));
            bzCellValue.Colspan = 3;
            bzCellValue.HorizontalAlignment = Element.ALIGN_LEFT;
            bzCellValue.VerticalAlignment = Element.ALIGN_MIDDLE;
            tblTitle.addCell(bzCellValue);

            document.Add(tblTitle);

            iTextSharp.text.Table tblDetail = new iTextSharp.text.Table(10);
            tblDetail.setWidths(new int[] { 9, 8, 11, 9, 9, 9, 9, 9, 15, 12 });
            tblDetail.WidthPercentage = 99;
            tblDetail.Border = 0;
            tblDetail.Cellpadding = 1;
            tblDetail.Cellspacing = 1;
            tblDetail.addCell(PdfHelper.GetCellLeft("承運商"));
            tblDetail.addCell(PdfHelper.GetCellLeft("數量"));
            tblDetail.addCell(PdfHelper.GetCellLeft("包裹重量"));
            tblDetail.addCell(PdfHelper.GetCellLeft("掛號費"));
            tblDetail.addCell(PdfHelper.GetCellLeft("取件費"));
            tblDetail.addCell(PdfHelper.GetCellLeft("材料費"));
            tblDetail.addCell(PdfHelper.GetCellLeft("保價費"));
            tblDetail.addCell(PdfHelper.GetCellLeft("其它費"));
            tblDetail.addCell(PdfHelper.GetCellLeft("條形碼"));
            tblDetail.addCell(PdfHelper.GetCellRight("應收合計"));

            foreach (OrderDetail od in result)
            {
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + od.CarrierEncode));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + od.Count.ToString()));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + StringHelper.CurtNumber(od.Weight.ToString())));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + StringHelper.CurtNumber(od.RegisterCosts.ToString())));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + StringHelper.CurtNumber(od.FetchCosts.ToString())));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + StringHelper.CurtNumber(od.MaterialCosts.ToString())));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + StringHelper.CurtNumber(od.InsureCosts.ToString())));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + StringHelper.CurtNumber(od.OtherCosts.ToString())));
                tblDetail.addCell(PdfHelper.GetCellLeft(" " + od.BarCode));
                tblDetail.addCell(PdfHelper.GetCellRight(" " + StringHelper.CurtNumber(od.TotalCosts.ToString())));
            }
//.........這裏部分代碼省略.........
開發者ID:sd1362168638,項目名稱:XSEMS,代碼行數:101,代碼來源:ReceiveOrder.aspx.cs


注:本文中的iTextSharp.text.Table.addCell方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。