Salve, ho trovato e modificato un codice appoggiandomi ad un libreria itextsharp e ho avuto un problema sulle dimensioni delle varie celle, non sono riuscito ad impostare le dimensioni della prima cella che deve essere più piccola della seconda e il secondo problema è stato che mi crea solo una pagina nel pdf invece io vorrei che mi creasse tante pagine quanti gli elementi da stampare.... ecco il codice:
codice:Private Sub PdfToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PdfToolStripMenuItem.Click Console.WriteLine("Chapter 10 example 9: a PdfPTable at an absolute position") ' step 1: creation of a document-object Dim document As New Document(PageSize.A4, 50, 50, 50, 50) Dim k As Integer Try ' step 2: we create a writer that listens to the document Dim writer As PdfWriter = PdfWriter.GetInstance(document, New FileStream("lista.pdf", FileMode.Create)) ' step 3: we open the document document.AddTitle("Lista dei films") document.AddAuthor("ToNyLuCa") document.Open() ' step 4: we add some content Dim table As New PdfPTable(2) table.DefaultCell.Border = Rectangle.ALIGN_LEFT Or Rectangle.ALIGN_RIGHT ' table.AddCell("Categoria") table.AddCell("Nome del Menù") table.AddCell("Titolo del Film") table.AddCell("") table.AddCell("") For k = 0 To ListView1.Items.Count - 1 table.AddCell(ListView1.Items(k).SubItems(0).Text) table.AddCell(ListView1.Items(k).SubItems(1).Text) Next table.AddCell("") table.AddCell("Totale dei film stampati : " & k) table.TotalWidth = 500 table.WriteSelectedRows(0, -1, 50, 800, writer.DirectContent) ' step 5: we close the document document.Close() Catch de As Exception Console.WriteLine(de.Message) Console.WriteLine(de.StackTrace) End Try System.Diagnostics.Process.Start("lista.pdf") End Sub

Rispondi quotando
