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


C# text.BaseColor类代码示例

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


BaseColor类属于iTextSharp.text命名空间,在下文中一共展示了BaseColor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GenerateRow

        private static void GenerateRow(PdfPTable table, PlayerInfo player, Font font, BaseColor backgroundColor)
        {
            var jpg = Image.GetInstance(player.PictureUrl);
            table.AddCell(jpg);

            PdfPCell cell;

            cell = new PdfPCell(new Phrase(player.JerseyNumber, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.Name, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            if (table.NumberOfColumns == NumberColsWithPosition)
            {
                cell = new PdfPCell(new Phrase(player.Position, font)) {BackgroundColor = backgroundColor};
                table.AddCell(cell);
            }

            cell = new PdfPCell(new Phrase(player.Height, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.Weight, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.DateOfBirth, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.Age, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);

            cell = new PdfPCell(new Phrase(player.BirthPlace, font)) {BackgroundColor = backgroundColor};
            table.AddCell(cell);
        }
开发者ID:ColinStranc,项目名称:MockDraftAnalysis,代码行数:34,代码来源:PdfGenerator.cs

示例2: BaseFontAndSize

 // 函数描述:设置字体的样式
 public static Font BaseFontAndSize(string fontName, int size, int style, BaseColor baseColor)
 {
     BaseFont.AddToResourceSearch("iTextAsian.dll");
     BaseFont.AddToResourceSearch("iTextAsianCmaps.dll");
     string fileName;
     switch (fontName)
     {
         case "黑体":
             fileName = "SIMHEI.TTF";
             break;
         case "华文中宋":
             fileName = "STZHONGS.TTF";
             break;
         case "宋体":
             fileName = "simsun_1.ttf";
             break;
         default:
             fileName = "simsun_1.ttf";
             break;
     }
     var baseFont = BaseFont.CreateFont(@"c:/windows/fonts/" + fileName, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
     var fontStyle = style < -1 ? Font.NORMAL : style;
     var font = new Font(baseFont, size, fontStyle, baseColor);
     return font;
 }
开发者ID:GankerChen2012,项目名称:PdfTools,代码行数:26,代码来源:ExamAnalysiseReportFormat.cs

示例3: LineSeparator

 /**
 * Creates a new instance of the LineSeparator class.
 * @param lineWidth      the thickness of the line
 * @param percentage the width of the line as a percentage of the available page width
 * @param color          the color of the line
 * @param align          the alignment
 * @param offset     the offset of the line relative to the current baseline (negative = under the baseline)
 */
 public LineSeparator(float lineWidth, float percentage, BaseColor lineColor, int align, float offset) {
     this.lineWidth = lineWidth;
     this.percentage = percentage;
     this.lineColor = lineColor;
     this.alignment = align;
     this.offset = offset;
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:15,代码来源:LineSeparator.cs

示例4: HeaderGeneration

        private static void HeaderGeneration(PdfPTable table, DateTime d)
        {
            string date = d.Date.ToString("dd-MMM-yyyy", CultureInfo.InvariantCulture);
            Font verdana2 = FontFactory.GetFont("Verdana", 12, Font.BOLD);
            d = d.Date;

            PdfPCell dateCell = new PdfPCell(new Phrase("Date: " + date));
            dateCell.Colspan = 5;
            dateCell.BackgroundColor = new BaseColor(242, 242, 242);
            table.AddCell(dateCell);

            BaseColor color = new BaseColor(217, 217, 217);
            PdfPCell product = new PdfPCell(new Phrase("Product", verdana2));
            product.BackgroundColor = color;
            table.AddCell(product);

            PdfPCell quantity = new PdfPCell(new Phrase("Quantity", verdana2));
            quantity.BackgroundColor = color;
            table.AddCell(quantity);

            PdfPCell unitPrice = new PdfPCell(new Phrase("Unit Price", verdana2));
            unitPrice.BackgroundColor = color;
            table.AddCell(unitPrice);

            PdfPCell location = new PdfPCell(new Phrase("Location", verdana2));
            location.BackgroundColor = color;
            table.AddCell(location);

            PdfPCell sum = new PdfPCell(new Phrase("Sum", verdana2));
            sum.BackgroundColor = color;
            table.AddCell(sum);
        }
开发者ID:TeamMingFern,项目名称:DatabaseApplicationsTeamwork,代码行数:32,代码来源:PDFGenerator.cs

示例5: GeneratePdfReport

        /// <summary>
        /// Creates PDF reports and saves them as a PDF file
        /// </summary>
        public static void GeneratePdfReport()
        {
            File.Delete(PdfPath + PdfFileName);
            var repo = new MSSqlRepository();
            var pdfData = repo.GetDataForPdfExport();
            var doc = new Document();

            PdfWriter.GetInstance(doc, new FileStream(PdfPath + PdfFileName, FileMode.Create));

            doc.Open();

            PdfPTable table = new PdfPTable(RowCountInPdfExport);
            table.DefaultCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
            table.DefaultCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;

            var headerBackground = new BaseColor(204, 204, 204);
            PdfPCell headerCell = new PdfPCell(new Phrase("Sample PDF Export From the Football Manager"));
            headerCell.Colspan = RowCountInPdfExport;
            headerCell.Padding = 10f;
            headerCell.HorizontalAlignment = 1;
            headerCell.BackgroundColor = headerBackground;
            table.AddCell(headerCell);

            string[] col = { "Date", "Staduim", "Home Team", "Away Team", "Result" };

            for (int i = 0; i < col.Length; ++i)
            {
                PdfPCell columnCell = new PdfPCell(new Phrase(col[i]));
                columnCell.VerticalAlignment = PdfPCell.ALIGN_MIDDLE;
                columnCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                columnCell.BackgroundColor = headerBackground;
                table.AddCell(columnCell);
            }

            foreach (var item in pdfData)
            {
                PdfPCell townCell = new PdfPCell(new Phrase(item.Key));
                townCell.Colspan = RowCountInPdfExport;
                townCell.Padding = 10f;
                table.AddCell(townCell);

                foreach (var match in item.Value)
                {
                    table.AddCell(match.Date.Day + "." + match.Date.Month + "." + match.Date.Year);
                    table.AddCell(match.Stadium);
                    table.AddCell(match.HomeTeam);
                    table.AddCell(match.AwayTeam);
                    table.AddCell(match.Result);
                }
            }

            doc.Add(table);
            doc.Close();
            Process.Start(PdfPath);
        }
开发者ID:Team-Selenium,项目名称:Football-Manager,代码行数:58,代码来源:PdfUtils.cs

示例6: CustomFontFactory

        public CustomFontFactory(
            string defaultFontFilePath,
            string defaultFontEncoding = BaseFont.IDENTITY_H,
            bool defaultFontEmbedding = BaseFont.EMBEDDED,
            float? defaultFontSize = null,
            int? defaultFontStyle = null,
            BaseColor defaultFontColor = null,
            bool automaticalySetReplacementForNullables = true)
        {
            //set default font properties
            DefaultFontPath = defaultFontFilePath;
            DefaultFontEncoding = defaultFontEncoding;
            DefaultFontEmbedding = defaultFontEmbedding;
            DefaultFontColor = defaultFontColor ?? DEFAULT_FONT_COLOR;
            DefaultFontSize = defaultFontSize ?? DEFAULT_FONT_SIZE;
            DefaultFontStyle = defaultFontStyle ?? DEFAULT_FONT_STYLE;

            //set default replacement options
            ReplaceFontWithDefault = false;
            ReplaceEncodingWithDefault = true;
            ReplaceEmbeddingWithDefault = false;

            if (automaticalySetReplacementForNullables)
            {
                ReplaceSizeWithDefault = defaultFontSize.HasValue;
                ReplaceStyleWithDefault = defaultFontStyle.HasValue;
                ReplaceColorWithDefault = defaultFontColor != null;
            }

            //define default font
            DefaultBaseFont = BaseFont.CreateFont(DefaultFontPath, DefaultFontEncoding, DefaultFontEmbedding);

            //register system fonts
            FontFactory.RegisterDirectories();
        }
开发者ID:TomKaminski,项目名称:ITAD2015,代码行数:35,代码来源:CustomFontFactory.cs

示例7: PdfPatternPainter

 internal PdfPatternPainter(PdfWriter wr, BaseColor defaultColor) : this(wr) {
     stencil = true;
     if (defaultColor == null)
         this.defaultColor = BaseColor.GRAY;
     else
         this.defaultColor = defaultColor;
 }
开发者ID:Gianluigi,项目名称:dssnet,代码行数:7,代码来源:PdfPatternPainter.cs

示例8: CreatePdfCell

 private PdfPCell CreatePdfCell(string cellInfo, Font font, BaseColor backgroundColor, int colSpan = 0, int horizontalAligment = 0)
 {
     var cell = new PdfPCell(new Phrase(cellInfo, font));
     cell.BackgroundColor = backgroundColor;
     cell.Colspan = colSpan;
     cell.HorizontalAlignment = horizontalAligment;
     return cell;
 }
开发者ID:GeriCookie,项目名称:Database-2015-Team-Flerovium-,代码行数:8,代码来源:PDFReporter.cs

示例9: GetCell

		public static PdfPCell GetCell(string content, Font font, int horizontalAlignment, BaseColor background = null)
		{
			return new PdfPCell(new Phrase(content, font))
			{
				BackgroundColor = background,
				HorizontalAlignment = horizontalAlignment,
			};
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:8,代码来源:PDFHelper.cs

示例10: CreateReport

        public static void CreateReport()
        {
            string directoryCreating = "..\\..\\..\\SalesReports.pdf";
            if (File.Exists(directoryCreating))
            {
                File.Delete(directoryCreating);
            }
            Document pdfReport = new Document();
            iTextSharp.text.pdf.PdfWriter writer = iTextSharp.text.pdf.PdfWriter.GetInstance(pdfReport,
                new System.IO.FileStream(directoryCreating, System.IO.FileMode.Create));

            pdfReport.Open();
            using (pdfReport)
            {
                PdfPTable reportTable = new PdfPTable(5);

                AddCellToTable(reportTable, "Aggregated Sales Report", TextAlign.Center, 5);

                using (var supermarketEntities = new SupermarketEntities())
                {
                    var reportsOrderedByDate = supermarketEntities.Reports.OrderBy(x => x.ReportDate);
                    var currentDate = reportsOrderedByDate.First().ReportDate;
                    decimal currentSum = 0;
                    decimal totalSum = 0;
                    var headerColor = new BaseColor(217, 217, 217);
                    AddHeader(reportTable, currentDate, headerColor);
                    // aligment  0 = left, 1 = center, 2 = right

                    foreach (var report in reportsOrderedByDate)
                    {
                        if (currentDate != report.ReportDate)
                        {
                            AddFooter(reportTable, "Total sum for " + currentDate.ToString(), currentSum);
                            currentSum = 0;
                            currentDate = report.ReportDate;
                            AddHeader(reportTable, currentDate, headerColor);
                        }
                        else
                        {
                            AddCellToTable(reportTable, report.Product.ProductName.ToString(), 0);
                            AddCellToTable(reportTable, report.Quantity.ToString(), 0);
                            AddCellToTable(reportTable, report.UnitPrice.ToString(), 0);
                            AddCellToTable(reportTable, report.Supermarket.ToString(), 0);
                            AddCellToTable(reportTable, report.Sum.ToString(), 0);
                            totalSum += (decimal)report.Sum;
                            currentSum += (decimal)report.Sum;
                        }
                    }

                    AddFooter(reportTable, "Total sum for " + currentDate.ToString(), currentSum);
                    AddFooter(reportTable, "Grand total:", totalSum);
                }

                pdfReport.Add(reportTable);
            }
        }
开发者ID:TeamMojito,项目名称:SupermarketsDatabaseClient,代码行数:56,代码来源:PdfReportert.cs

示例11: CalendarAttributes

 /// <summary>
 /// MonthCalendar's attributes.
 /// </summary>
 public CalendarAttributes()
 {
     RelativeColumnWidths = new float[] { 1, 1, 1, 1, 1, 1, 1 };
     BorderColor = BaseColor.LIGHT_GRAY;
     GradientStartColor = new BaseColor(Color.LightGray.ToArgb());
     GradientEndColor = new BaseColor(Color.DarkGray.ToArgb());
     Padding = 5;
     UseLongDayNamesOfWeek = true;
     DayNamesRowBackgroundColor = new BaseColor(Color.WhiteSmoke.ToArgb());
 }
开发者ID:VahidN,项目名称:PdfReport,代码行数:13,代码来源:CalendarAttributes.cs

示例12: ColoredTxtCell

 public static PdfPCell ColoredTxtCell(string content, BaseColor color = null)
 {
     PdfPCell c = new PdfPCell(new Phrase(content));
     //     c.Border = PdfPCell.BOTTOM_BORDER | PdfPCell.TOP_BORDER | PdfPCell.LEFT_BORDER | PdfPCell.RIGHT_BORDER;
     c.Padding = 4;
     c.BorderWidth = 1;
     c.BorderColor = new BaseColor(System.Drawing.Color.Transparent);
     _getColoredCell(c, color);
     return c;
 }
开发者ID:gdlprj,项目名称:duscusys,代码行数:10,代码来源:PdfTools.cs

示例13: CreateFooterCell

        private static PdfPCell CreateFooterCell(string cellValue, int colspan = 1, bool isBold = false, BaseColor backgroundColor = null)
        {
            PdfPCell cell = new PdfPCell(new Phrase(cellValue, new Font(DefaultFont, 10f, isBold ? Font.BOLD : Font.NORMAL)));
            cell.Colspan = colspan;
            cell.HorizontalAlignment = Element.ALIGN_RIGHT;
            cell.Padding = DefaultCellPadding;
            cell.BackgroundColor = backgroundColor;

            return cell;
        }
开发者ID:Okiana,项目名称:Team-Diosma,代码行数:10,代码来源:SalesReportGenerator.cs

示例14: AddBorderToTable

 // Public Methods (6)
 /// <summary>
 /// Adds a border to an existing PdfGrid
 /// </summary>
 /// <param name="table">Table</param>
 /// <param name="borderColor">Border's color</param>
 /// <param name="spacingBefore">Spacing before the table</param>
 /// <returns>A new PdfGrid</returns>
 public static PdfGrid AddBorderToTable(this PdfGrid table, BaseColor borderColor, float spacingBefore)
 {
     var outerTable = new PdfGrid(numColumns: 1)
     {
         WidthPercentage = table.WidthPercentage,
         SpacingBefore = spacingBefore
     };
     var pdfCell = new PdfPCell(table) { BorderColor = borderColor };
     outerTable.AddCell(pdfCell);
     return outerTable;
 }
开发者ID:VahidN,项目名称:PdfReport,代码行数:19,代码来源:TableHelper.cs

示例15: PDFStyle

		static PDFStyle()
		{
			var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial.TTF");
			BaseFont = BaseFont.CreateFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
			NormalFont = new Font(BaseFont, Font.DEFAULTSIZE, Font.NORMAL);
			BoldFont = new Font(BaseFont, Font.DEFAULTSIZE, Font.BOLD);

			TextFont = new Font(BaseFont, 12, Font.NORMAL);
			BoldTextFont = new Font(BaseFont, 12, Font.BOLD);
			HeaderFont = new Font(BaseFont, 16, Font.BOLD);
			HeaderBackground = new BaseColor(unchecked((int)0xFFD3D3D3));
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:12,代码来源:PDFStyle.cs


注:本文中的iTextSharp.text.BaseColor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。