private void UsingFixedContentEditor() { #region radpdfprocessing-editing-table_9 Table table = GenerateSampleTable(); RadFixedDocument document = new RadFixedDocument(); RadFixedPage page = document.Pages.AddPage(); FixedContentEditor editor = new FixedContentEditor(page, new SimplePosition()); editor.Position.Translate(10, 100); editor.Position.Rotate(-45); editor.DrawTable(table); #endregion }
private void InsertTable() { #region radpdfprocessing-editing-fixedcontenteditor_8 Table table = new Table(); Border border = new Border(); table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border); table.DefaultCellProperties.Padding = new Thickness(10); TableRow firstRow = table.Rows.AddTableRow(); firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("First cell"); firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Second cell"); firstRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Third cell"); TableRow secondRow = table.Rows.AddTableRow(); secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Forth cell"); secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Fifth cell"); secondRow.Cells.AddTableCell().Blocks.AddBlock().InsertText("Sixth cell"); RadFixedDocument document = new RadFixedDocument(); RadFixedPage page = document.Pages.AddPage(); FixedContentEditor editor = new FixedContentEditor(page); editor.Position.Translate(10, 10); editor.DrawTable(table, new Size(180, double.PositiveInfinity)); #endregion }
private double AddEmploymentPeriod(FixedContentEditor editor, double width) { // this is a table with two rows // each row has two cells // the first cell contains a description // the second cel contains a value Table table = new Table(); TableRow firstRow = table.Rows.AddTableRow(); TableCell cell1 = firstRow.Cells.AddTableCell(); cell1.PreferredWidth = 200; Block block1 = cell1.Blocks.AddBlock(); block1.HorizontalAlignment = (Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment)HorizontalAlignment.Left; block1.TextProperties.FontSize = 20; block1.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block1.InsertText("Eintrittsdatum:"); TableCell cell2 = firstRow.Cells.AddTableCell(); cell2.PreferredWidth = 200; Block block2 = cell2.Blocks.AddBlock(); block2.HorizontalAlignment = (Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment)HorizontalAlignment.Left; block2.TextProperties.FontSize = 20; block2.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block2.InsertText(FormattedDateJoined); TableRow secondRow = table.Rows.AddTableRow(); TableCell cell3 = secondRow.Cells.AddTableCell(); cell3.PreferredWidth = 200; Block block3 = cell3.Blocks.AddBlock(); block3.HorizontalAlignment = (Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment)HorizontalAlignment.Left; block3.TextProperties.FontSize = 20; block3.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block3.InsertText("Austrittsdatum:"); TableCell cell4 = secondRow.Cells.AddTableCell(); cell4.PreferredWidth = 200; Block block4 = cell4.Blocks.AddBlock(); block4.HorizontalAlignment = (Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment)HorizontalAlignment.Left; block4.TextProperties.FontSize = 20; block4.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block4.InsertText(FormattedDateLeft); editor.DrawTable(table); Size size = table.Measure(); return(size.Height); }
private double AddAnnualOverview(FixedContentEditor editor, double width) { Table table = new Table(); // HeaderCells TableRow headerRow = table.Rows.AddTableRow(); TableCell cell1 = headerRow.Cells.AddTableCell(); cell1.PreferredWidth = 150; Block block1 = cell1.Blocks.AddBlock(); block1.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center; block1.GraphicProperties.FillColor = new RgbColor(0, 0, 255); block1.TextProperties.FontSize = 14; block1.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block1.InsertText("Kalenderjahr"); TableCell cell2 = headerRow.Cells.AddTableCell(); cell2.PreferredWidth = 150; Block block2 = cell2.Blocks.AddBlock(); block2.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Right; block2.GraphicProperties.FillColor = new RgbColor(0, 0, 255); block2.TextProperties.FontSize = 14; block2.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block2.InsertText("Gehalt"); TableCell cell3 = headerRow.Cells.AddTableCell(); cell3.PreferredWidth = 150; Block block3 = cell3.Blocks.AddBlock(); block3.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Right; block3.GraphicProperties.FillColor = new RgbColor(0, 0, 255); block3.TextProperties.FontSize = 14; block3.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block3.InsertText("Bonus"); TableCell cell4 = headerRow.Cells.AddTableCell(); cell4.PreferredWidth = 150; Block block4 = cell4.Blocks.AddBlock(); block4.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Right; block4.GraphicProperties.FillColor = new RgbColor(0, 0, 255); block4.TextProperties.FontSize = 14; block4.TextProperties.TrySetFont(new FontFamily("Calibri"), FontStyles.Normal, FontWeights.Bold); block4.InsertText("Gesamtvergütung"); // foreach year one Row foreach (EmployeeSalaryDetail detail in EmployeeAnnualDetails) { TableRow annualRow = table.Rows.AddTableRow(); AddRowContent(annualRow, detail); } editor.DrawTable(table); Size size = table.Measure(); return(size.Height); }
private static void DrawData(FixedContentEditor editor, double maxWidth, decimal ParametroFedex) { EnsamblesRealizadosService _ServiceER = new EnsamblesRealizadosService(); MaterialShippingControlEntities BD = new MaterialShippingControlEntities(); double WriteWhere = 160; //Define el actual tope del editor Block block = new Block(); //Declara un nuevo bloque //SaltoLinea editor.Position.Translate(MargenIzquierdo, WriteWhere);//Mueve ele editor using (block.SaveTextProperties()) { block.TextProperties.Font = FontsRepository.CourierBold; block.InsertText(new FontFamily("Calibri"), "FEDEX TRACKING: "); } block.InsertText(new FontFamily("Calibri"), ParametroFedex.ToString()); editor.DrawBlock(block); //SaltoLinea WriteWhere += AnchoDeLinea * 2; //Salto de linea al editor editor.Position.Translate(MargenIzquierdo, WriteWhere); //Mueve ele editor block = new Block(); //Declara un nuevo bloque using (block.SaveTextProperties()){ block.InsertText(new FontFamily("Calibri"), "REFERENCE: "); } block.InsertText(new FontFamily("Calibri"), _ServiceER.ReadE(ParametroFedex)); editor.DrawBlock(block); //SaltoLinea block = new Block(); //Declara un nuevo bloque WriteWhere += AnchoDeLinea * 3; //Salto de linea al editor editor.Position.Translate(MargenIzquierdo, WriteWhere); //Mueve ele editor block.InsertText("FINISH PRODUCT: SHIPMENTS TO THE UNITED STATES PACKING LIST"); block.TextProperties.Font = FontsRepository.Helvetica; block.TextProperties.FontSize = 11; editor.DrawBlock(block); WriteWhere += AnchoDeLinea * 2; //Salto de linea al editor editor.Position.Translate(50, WriteWhere); //Mueve ele editor RgbColor headerColor = new RgbColor(196, 196, 196); //Color de Header RgbColor bordersColor = new RgbColor(255, 255, 255); //Color de los bordes RgbColor alternatingRowColor = new RgbColor(224, 224, 224); //Color de rows Border border = new Border(1, Editing.BorderStyle.Single, bordersColor); //Estilo de borde Table table = new Table { Borders = new TableBorders(border), //A la propiedad borders de la tabla se le agrega el estilo de borde creado LayoutType = TableLayoutType.FixedWidth //Tipo de dise;o }; //Nuevo objeto tabla table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border); //Bordes de la tabla se les da las propiedades del objeto borde table.DefaultCellProperties.Padding = new System.Windows.Thickness(2); //Padding de tabla TableRow NewFila = table.Rows.AddTableRow(); //Nuevo objeto TableRow se anade a la tabla /////////////////////////////////////////////////////////////////////Contenido de la tabla/////////////////////////////////////////// TableCell ObjetoCelda = NewFila.Cells.AddTableCell();//Objeto TableCell se anade a la tabla como fila ObjetoCelda.PreferredWidth = 100; ObjetoCelda.Background = headerColor; //A partir de ahora se declaran celdas que se agregaran al row Block ObjetoBlock = ObjetoCelda.Blocks.AddBlock(); //Declara un objeto de clase Block ObjetoBlock.TextProperties.FontSize = 11; ObjetoBlock.HorizontalAlignment = HorizontalAlignment.Center; //Le da la alineacion ObjetoBlock.VerticalAlignment = VerticalAlignment.Center; ObjetoBlock.InsertText("PACKAGING INFORMATION"); //Agrega el texto de la primera columna ////----------SegundaColumna TableCell ObjetoCelda2 = NewFila.Cells.AddTableCell(); //Objeto TableCell se anade a la tabla como fila ObjetoCelda2.Background = headerColor; //Toma el color de fondo ObjetoCelda2.PreferredWidth = 250; Block ObjetoBlock2 = ObjetoCelda2.Blocks.AddBlock(); //Declara un objeto de clase Block ObjetoBlock2.TextProperties.FontSize = 11; ObjetoBlock2.HorizontalAlignment = HorizontalAlignment.Center; //Le da la alineacion ObjetoBlock2.VerticalAlignment = VerticalAlignment.Center; ObjetoBlock2.InsertText("PART NUMBER"); //Le agrega el texto en el formato dado ////----------TerceraColumna TableCell ObjetoCelda3 = NewFila.Cells.AddTableCell(); //Objeto TableCell se anade a la tabla como fila ObjetoCelda3.Background = headerColor; //Toma el color de fondo ObjetoCelda3.PreferredWidth = 100; Block ObjetoBlock3 = ObjetoCelda3.Blocks.AddBlock(); //Declara un objeto de clase Block ObjetoBlock3.TextProperties.FontSize = 11; ObjetoBlock3.VerticalAlignment = VerticalAlignment.Center; ObjetoBlock3.HorizontalAlignment = HorizontalAlignment.Center; //Le da la alineacion ObjetoBlock3.InsertText("QUANTITY SHIPPED"); //Le agrega el texto en el formato dado int i = 0; foreach (var sel in _ServiceER.ReadD(ParametroFedex)) { i++; TableRow FilaContent = table.Rows.AddTableRow(); //Nuevo objeto TableRow se anade a la tabla RgbColor rowColor = i % 2 == 0 ? alternatingRowColor : RgbColors.White; // Alterna el color de la tabla obteniendo el residuo de la variable del ciclo //1erCampo TableCell ObjetoContenido = FilaContent.Cells.AddTableCell(); //Objeto TableCell se anade a la tabla como fila ObjetoContenido.Background = rowColor; //Toma el color de fondo Block amountBlock = ObjetoContenido.Blocks.AddBlock(); amountBlock.TextProperties.FontSize = 8; amountBlock.HorizontalAlignment = HorizontalAlignment.Center; amountBlock.InsertText(sel.RecordPieceBoxNo.ToString()); //SegundoCampo TableCell ObjetoContenido2 = FilaContent.Cells.AddTableCell(); //Objeto TableCell se anade a la tabla como fila ObjetoContenido2.Background = rowColor; //Toma el color de fondo Block amountBlock2 = ObjetoContenido2.Blocks.AddBlock(); amountBlock2.TextProperties.FontSize = 8; amountBlock2.HorizontalAlignment = HorizontalAlignment.Center; amountBlock2.InsertText(sel.ProductName); //3er Campo TableCell ObjetoContenido3 = FilaContent.Cells.AddTableCell(); //Objeto TableCell se anade a la tabla como fila ObjetoContenido3.Background = rowColor; //Toma el color de fondo Block amountBlock3 = ObjetoContenido3.Blocks.AddBlock(); amountBlock3.TextProperties.FontSize = 8; amountBlock3.HorizontalAlignment = HorizontalAlignment.Center; amountBlock3.InsertText(sel.RecordCantidad.ToString()); } ////////////////////////////////////////////////////////////////////Contenido de la tabla/////////////////////////////////////////// editor.DrawTable(table); }