当前位置: 首页>>代码示例>>C#>>正文


C# Table.setWidths方法代码示例

本文整理汇总了C#中iTextSharp.text.Table.setWidths方法的典型用法代码示例。如果您正苦于以下问题:C# Table.setWidths方法的具体用法?C# Table.setWidths怎么用?C# Table.setWidths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iTextSharp.text.Table的用法示例。


在下文中一共展示了Table.setWidths方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnProfitReport_Click


//.........这里部分代码省略.........
            titleContent += "结束日期:" + endDate.ToShortDateString() + "      ";
        }

        if (ddlReportType.SelectedItem.Value == "1")
        {

            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));
开发者ID:sd1362168638,项目名称:XSEMS,代码行数:67,代码来源:AssessReport.aspx.cs

示例2: btnUserReport_Click


//.........这里部分代码省略.........
        {
            titleContent += "结束日期:" + endDate.ToShortDateString() + "      ";
        }

        if (ddlReportType.SelectedItem.Value == "1")
        {
            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);
开发者ID:sd1362168638,项目名称:XSEMS,代码行数:67,代码来源:AssessReport.aspx.cs

示例3: btnArDetailStatistic_Click


//.........这里部分代码省略.........
            titleContent += "结束日期:" + endDate.ToShortDateString() + "      ";
        }

        if (ddlReportType.SelectedItem.Value == "1")
        {

            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;
开发者ID:sd1362168638,项目名称:XSEMS,代码行数:67,代码来源:AlreadyReceivedReport.aspx.cs

示例4: btnClientStatistic_Click

    protected void btnClientStatistic_Click(object sender, EventArgs e)
    {
        string sDate = Request.Form[txtStartDate.ID].Trim();
        string eDate = Request.Form[txtEndDate.ID].Trim();

        DateTime startDate = new DateTime();
        if (string.IsNullOrEmpty(sDate))
        {
            startDate = minTime;
        }
        else
        {
            startDate = DateTime.Parse(sDate);
        }

        DateTime endDate = new DateTime();
        if (string.IsNullOrEmpty(eDate))
        {
            endDate = minTime;
        }
        else
        {
            endDate = DateTime.Parse(eDate);
            endDate = new DateTime(endDate.Year, endDate.Month, endDate.Day, 23, 59, 59);
        }

        string strCompanyId = ddlCompany.SelectedItem.Value;
        string strCompanyName = ddlCompany.SelectedItem.Text;

        int companyId = 0;
        if (!int.TryParse(strCompanyId, out companyId))
        {
            companyId = 0;
        }

        string strUserId = "0";
        if (ddlCompany.SelectedItem.Value != "0")
        {
            strUserId = ddlCompanyUsers.SelectedItem.Value;
        }

        int userId = 0;
        if (!int.TryParse(strUserId, out userId))
        {
            userId = 0;
        }

        List<Client> result = ClientOperation.GetClientStatistic(startDate, endDate, companyId, userId);

        string fileName = StringHelper.GetEncodeNumber("KH");
        string titleContent = "";
        if (ddlCompany.SelectedItem.Value != "0")
        {
            titleContent = "所属公司:" + strCompanyName + "      ";
        }
        if (startDate > minTime)
        {
            titleContent += "开始日期:" + startDate.ToShortDateString() + "      ";
        }

        if (endDate > minTime)
        {
            titleContent += "结束日期:" + endDate.ToShortDateString() + "      ";
        }

        if (ddlReportType.SelectedItem.Value == "1")
        {
            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;

//.........这里部分代码省略.........
开发者ID:sd1362168638,项目名称:XSEMS,代码行数:101,代码来源: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.setWidths方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。