Hi from France ! (and excuse me for my bad english)
After 3 days on RadFixedDocument to make a PDF file, i need help !
I must make a PDF File based on my Asp.net Vb.net website (attached file)
i must make a document with "same" design : Landscape document and grids on left and on right
Dim document As New Telerik.Windows.Documents.Fixed.Model.RadFixedDocumentdocument.DocumentInfo.Author = "(c) Francelot"document.DocumentInfo.Title = "Bilan Gestion"Dim ex As New Telerik.Windows.Documents.Fixed.Model.Editing.RadFixedDocumentEditor(document)ex.SectionProperties.PageRotation = Telerik.Windows.Documents.Fixed.Model.Data.Rotation.Rotate90ex.InsertSectionBreak()ex.InsertRun("TEST")ex.InsertLine("Bilan Gestion")ex.Dispose()
After this i got landscape document but my text is right to left (write not landscape, just rotate page ...)
Thank for your help !
Vincent.
3 Answers, 1 is accepted
0
Hello Vencent,
Note that the PageRotation property will rotate the section and also its content. Instead, you can try setting the PageSize of the sections. This way you can define a landscape size. For example:
I hope this helps.
Regards,
Martin
Telerik by Progress
Note that the PageRotation property will rotate the section and also its content. Instead, you can try setting the PageSize of the sections. This way you can define a landscape size. For example:
var ex = new RadFixedDocumentEditor(document);ex.SectionProperties.PageSize = new Size(840, 480);I hope this helps.
Regards,
Martin
Telerik by Progress
0
Vincent
Top achievements
Rank 1
Iron
Iron
answered on 29 Nov 2016, 03:54 PM
Hello Martin,
Since my pdf is 80% finish. (result see in 4 png attached files)
my boss wants now adding Page number on pdf, but how... not found...
At the beginning he want 2 tables ("want" png attached file) :
- At Left : "Dépenses" table
- At Right : "Recettes" table
Perhaps something must be improuved
Thanks for your help.
This is my code :
Dim document As New RadFixedDocumentUsing Editor As Editing.RadFixedDocumentEditor = New Editing.RadFixedDocumentEditor(document) With Editor .SectionProperties.PageSize = A4P .SectionProperties.PageMargins = New Telerik.Windows.Documents.Primitives.Padding(48.768) 'Titre Genéral .ParagraphProperties.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Center .CharacterProperties.FontSize = 34 .InsertParagraph() .InsertLine("Bilan Gestion") ' ... here call my generate headerFor Each bilan In Bilans.CharacterProperties.FontSize = 18 .InsertLine(String.Format(maskTypeBilan, Francelot.BilanGestion.Utils.ConvertTypeSousBilanToStr(bilan.TypeBilan))) 'Depenses .CharacterProperties.FontSize = 16 .InsertLineBreak() .InsertLine("Dépenses") .CharacterProperties.FontSize = 14 'Appel Génération Table For Each Depense In bilan.Depenses.Repartition Dim depenseTable As Editing.Tables.Table = Depense.ForPDF() .InsertTable(depenseTable) Next 'Recettes .CharacterProperties.FontSize = 16 .InsertLineBreak() .InsertLine("Recettes") .CharacterProperties.FontSize = 14 'Appel Génération Table Dim grpList As New List(Of String) For Each Recette In bilan.Recettes.Repartition If Not IsNothing(Recette.NomGroupe) AndAlso Not grpList.Contains(Recette.NomGroupe) Then grpList.Add(Recette.NomGroupe) .InsertLine(Recette.NomGroupe) End If Dim recetteTable As Editing.Tables.Table = Recette.ForPDF() .InsertTable(recetteTable) Next Next End WithEnd Using
My Table Generator :
Public Function ForPDF() As Editing.Tables.Table Dim colorBorder As New ColorSpaces.RgbColor(0, 0, 0) Dim colorTableHeader As New ColorSpaces.RgbColor(225, 225, 225) Dim border As New Editing.Border(1, colorBorder) Dim borders As New Editing.Tables.TableCellBorders(border, border, border, border) Dim paddingHeader As New System.Windows.Thickness(6, 4, 6, 4) Dim paddingData As New System.Windows.Thickness(6, 4, 6, 4) Dim libelleSize As Integer = 400 Dim dataSize As Integer = 150 Dim t As New Editing.Tables.Table t.LayoutType = Editing.Flow.TableLayoutType.AutoFit t.DefaultCellProperties.Borders = borders Dim rHeader As Editing.Tables.TableRow = t.Rows.AddTableRow 'Headers With rHeader Dim b As Editing.Block For Each col As DataColumn In Repartition.Columns If Not NoPrintColName.Contains(col.ColumnName) Then Dim maHeaderCell As Editing.Tables.TableCell = .Cells.AddTableCell() maHeaderCell.Background = colorTableHeader maHeaderCell.Padding = paddingHeader b = maHeaderCell.Blocks.AddBlock Dim entete As String = Nothing If col.ColumnName <> LibellecolName Then b.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Center maHeaderCell.PreferredWidth = dataSize entete = col.Caption Else b.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Left maHeaderCell.PreferredWidth = libelleSize entete = col.Caption.ToUpper End If b.InsertText(entete) End If Next End With 'Rows Dim monTexte As String = Nothing Dim rowSpanned As Boolean = False Dim ProvisionFirstDataColumnPassed As Boolean = False For Each row As DataRow In Repartition.Rows Dim tr As Editing.Tables.TableRow = t.Rows.AddTableRow With tr For Each col As DataColumn In Repartition.Columns If Not NoPrintColName.Contains(col.ColumnName) Then Dim maCell As Editing.Tables.TableCell = .Cells.AddTableCell() maCell.Padding = paddingData Dim b As Editing.Block = maCell.Blocks.AddBlock() 'Si Ligne Provision If Repartition.Columns.Contains(ColNameTypeRow) AndAlso row(ColNameTypeRow) = "P" Then If col.ColumnName = LibellecolName Then monTexte = row(col.ColumnName).ToString() b.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Right 'Libelle Else If ProvisionFirstDataColumnPassed Then maCell.ColumnSpan = 2 rowSpanned = True monTexte = String.Empty Else monTexte = String.Format("{0:N2}", 111111) 'Debug Publication Forum 'monTexte = String.Format("{0:N2}", row(col.ColumnName)) ProvisionFirstDataColumnPassed = True End If b.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Right End If Else If col.ColumnName = LibellecolName Then monTexte = row(col.ColumnName).ToString() b.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Left 'Libelle Else monTexte = String.Format("{0:N2}", 111111) 'Debug Publication Forum 'monTexte = String.Format("{0:N2}", row(col.ColumnName)) b.HorizontalAlignment = Editing.Flow.HorizontalAlignment.Right 'DATA End If End If b.InsertText(monTexte) If rowSpanned Then ProvisionFirstDataColumnPassed = False rowSpanned = False Exit For End If End If Next End With Next Return t End Function0
Hello Vincent,
There is no built-in support for page number. To add such you will need create a text element and insert it in the pdf document.
To add two tables on a single row you can wrap them into another table with two columns. Place the one table in the first column and the second one in the second column.
Regards,
Martin
Telerik by Progress
There is no built-in support for page number. To add such you will need create a text element and insert it in the pdf document.
To add two tables on a single row you can wrap them into another table with two columns. Place the one table in the first column and the second one in the second column.
Regards,
Martin
Telerik by Progress
