本文整理汇总了C#中TableRow.NormalizeWidths方法的典型用法代码示例。如果您正苦于以下问题:C# TableRow.NormalizeWidths方法的具体用法?C# TableRow.NormalizeWidths怎么用?C# TableRow.NormalizeWidths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TableRow
的用法示例。
在下文中一共展示了TableRow.NormalizeWidths方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetSample
public static FPdf GetSample(string path)
{
var pdf = new Sample8();
pdf.AddPage();
pdf.SetMargins(20, 20, 20);
pdf.SetFont("Arial", string.Empty, 14);
pdf.Image(System.IO.Path.Combine(path, "logo.png"), 10, 12, 30, 0, ImageTypeEnum.Default, "http://www.fpdf.org");
var rowHeader = new TableRow(22, 120)
.SetBorder("0")
.SetCellHeight(5);
//pdf.PaintRow(rowHeader, "", @"Strada General Traian Moșoiu 24, <<--- characted not supported
pdf.Ln(3);
pdf.SetFontSize(10);
pdf.PaintRow(rowHeader, "", @"Strada General Traian Mosoiu 24,
Bran 507025,
Romania");
pdf.SetY(pdf.TopMargin);
pdf.SetFontSize(32);
var alignRight = new TableRow(pdf.CurrentPageSize.Width - pdf.LeftMargin - pdf.RightMargin).SetBorder("");
alignRight.Cells.Last().Align = AlignEnum.Right;
pdf.PaintRow(alignRight, "INVOICE");
pdf.SetY(50);
pdf.SetFontSize(25);
pdf.WriteHtml("<b>Happy Teeth</b>", 12);
pdf.Ln();
pdf.SetFontSize(14);
pdf.WriteHtml("<i>Medical Care</i>", 8);
pdf.Ln();
pdf.SetFont("Arial", string.Empty, 10);
pdf.Write(6, "VAT number: RO34.123.666-Z");
pdf.Ln();
pdf.SetY(50);
var clientRow = new TableRow(100, 50).SetBorder();
pdf.PaintRow(clientRow, "", "CLIENT");
pdf.PaintRow(clientRow, "", "Jonathan Harker");
clientRow.CellHeight = 4;
pdf.PaintRow(clientRow, "", "Lyndhurst Rd");
pdf.PaintRow(clientRow, "", "Exeter");
pdf.PaintRow(clientRow, "", "EX2 4PA");
pdf.PaintRow(clientRow, "", "UK");
pdf.SetY(100);
DecoratorLine(pdf);
var row = new TableRow(0.25, 0.95, 0.2, 0.3, 0.4);
row.Cells[4].Align = AlignEnum.Right;
row.Cells[3].Align = AlignEnum.Right;
row.Cells[2].Align = AlignEnum.Right;
row.Cells[1].Align = AlignEnum.Justified;
row.NormalizeWidths(pdf.CurrentPageSize.Width - pdf.LeftMargin - pdf.RightMargin);
pdf.PaintRow(row, "CODE", "DESCRIPTION", "QTY", "UNIT PRICE", "PRICE");
pdf.PaintRow(row, "00002", "Journey to the Center of the Earth", "2", "$7.95", "$15.90");
pdf.PaintRow(row, "00002", "Around the World in 80 Days", "1", "$7.95", "$7.95");
pdf.PaintRow(row, "00002", "The Misterious Island", "1", "$7.95", "$7.95");
for (int i = 0; i < 10; i++)
{
pdf.PaintRow(row);
}
var totalsRow = new TableRow(1, 0.4, 0.3, 0.4)
.NormalizeWidths(pdf.CurrentPageSize.Width - pdf.LeftMargin - pdf.RightMargin)
.SetAlign(AlignEnum.Right);
totalsRow.Cells[0].Border = "0";
totalsRow.Cells[1].Border = "0";
totalsRow.Cells[1].Align = AlignEnum.Left;
pdf.PaintRow(totalsRow, "", "Invoiced amount", "", "$100.00");
pdf.PaintRow(totalsRow, "", "Vat", "20%", "$20.00");
pdf.PaintRow(totalsRow, "", "Due amount", "", "$120.00");
pdf.Ln(16);
var points = new[]
{
new DrawingPoint(0, 0),
new DrawingPoint(5, -5),
new DrawingPoint(5, -15),
new DrawingPoint(120, -15),
new DrawingPoint(120, 15),
new DrawingPoint(5, 15),
new DrawingPoint(5, 5),
new DrawingPoint(0, 0)
};
foreach (var drawingPoint in points)
{
//.........这里部分代码省略.........
示例2: DecoratorLine
private static void DecoratorLine(Sample8 pdf)
{
var decorator = new TableRow(10, 1, 1, 0.5)
.SetBorder()
.SetCellHeight(2);
decorator.NormalizeWidths(pdf.CurrentPageSize.Width - pdf.LeftMargin - pdf.RightMargin);
decorator.Cells[0].Background = Color.Cyan;
decorator.Cells[1].Background = Color.Green;
decorator.Cells[2].Background = Color.Orange;
decorator.Cells[3].Background = Color.YellowGreen;
pdf.PaintRow(decorator, "", "", "", "", "");
pdf.Ln(5);
}