I have an app that i am using with no problems when i add text to an exiosting pdf document. What i need to do now is create tables and add the data to cells to create my documents on the fly. I do this in my web applications no problem, yet when i run the same code in windows forms it crashes the application. No errors to catch ata all, just cloises the app. I am trying to use code copied directly from your help files
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
Imports ceTe.DynamicPDF.PageElements
Public Sub CreatePDFTableTest()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
Dim MyTable As Table = New Table(0, 0, 400, 400)
' Add columns to the table
MyTable.Columns.Add(90)
MyTable.Columns.Add(150)
MyTable.Columns.Add(110)
'code crashes at the following line***********
' The first row is used as a table heading
Dim MyRow1 As Row = MyTable.Rows.Add(20, ceTe.DynamicPDF.Font.Helvetica, 14, RgbColor.Black, _
RgbColor.Gray)
MyRow1.Align = CellAlign.Center
MyRow1.VAlign = CellVAlign.Center
MyRow1.Cells.Add("Page Element", 3)
' The second row is the column headings
Dim MyRow2 As Row = MyTable.Rows.Add(ceTe.DynamicPDF.Font.Helvetica, 12)
MyRow2.Align = CellAlign.Center
MyRow2.Cells.Add("Name")
MyRow2.Cells.Add("Element")
MyRow2.Cells.Add("Implements IArea")
' Add IArea page elements directly to the cell
Dim MyRow3 As Row = MyTable.Rows.Add(30)
MyRow3.Cells.Add("FormattedTextArea")
Dim FormattedText As String = "font face, color, bold."
MyRow3.Cells.Add(New FormattedTextArea(FormattedText, 0, 0, 140, 100, _
FontFamily.Helvetica, 12, False))
Dim MyCell1 As Cell = MyRow3.Cells.Add("YES")
MyCell1.Align = CellAlign.Center
MyCell1.VAlign = CellVAlign.Center
' Add page elemnts (Lines) to a cell using the AreaGroup
Dim MyRow4 As Row = MyTable.Rows.Add(30)
MyRow4.Cells.Add("Line")
Dim LineAreaGroup As AreaGroup = New AreaGroup(150, 150)
LineAreaGroup.Add(New Line(25, 25, 125, 125, 5))
LineAreaGroup.Add(New Line(25, 125, 125, 25, 5))
MyRow4.Cells.Add(LineAreaGroup)
Dim MyCell2 As Cell = MyRow4.Cells.Add("NO")
MyCell2.Align = CellAlign.Center
MyCell2.VAlign = CellVAlign.Center
' Add the table to the page
MyPage.Elements.Add(MyTable)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
What am i doing wrong, or can you just not add tables in a winform?
Windows Form create table crashes program
Re: Windows Form create table crashes program
Support · Apr 7, 2008Hello,
We are successfully able to run the code you posted in a winform example without any problem. The PDF document gets generated fine with the Table. Can you please make sure that you are using the very latest Build DLL files from the web site?
Thanks,
ceTe Software Support Team
Re: Windows Form create table crashes program
Forum member · Apr 7, 2008Is the latest version 4.0.3? That is all i have access to on the site and it is what i am running now.
Cheers
Re: Windows Form create table crashes program
Support · Apr 7, 2008Hello,
The latest version available on our web site is v4.0.3 Build 80214 as of today. Can you download the very latest version from the web site and test the example? If you continue getting the same behavior, send an email to our [^a|mailto:support@cete.com|Support Team^] and we can send you an example to test and see if that works or not.
Thanks,
ceTe Software Support Team
Re: Windows Form create table crashes program
Forum member · Apr 14, 2008Where do i get this latest build? I can login to my download section but all i get is the download i already have. Can your support team send me an example to test?
Re: Windows Form create table crashes program
Forum member · Apr 14, 2008I downloaded from my customer section and it was now the correct build as you sadi. Sorry for jumping the gun on the last email. I rebuilt my project with the new dll referenced but it still does not work. Can i get an example from you of a working copy? I will email support as you suggested also.
Thanks.
Re: Windows Form create table crashes program
Forum member · Apr 14, 2008The report is written to the filesystem now, that build must have fixed whatever problem i was having. But how do i make it open to the user as it did with DrawToWeb?
Re: Windows Form create table crashes program
Forum member · Apr 14, 2008I got it working using the
' System.Diagnostics.Process.Start("C:\MyDocument.pdf")'
Found on forums
Guess i am all cleared up now, thanks for the help!
Cheers