Subject line should read :   PDFPTableEvents and Canvasing

[rodney.williams]
1. Can someone provide code in either C# or Java ( I can usually translate into 
vb.net)  which simply fires a table event where I can iterate through each row 
and column. My understanding is that table layout and canvassing is involved. 
If we can build on the code I provided, I hope the code will be simple.  I 
provided  a working CreatePDF but  The PDF Event procedure is one I tried to 
make work but couldn't. My goal is to get the x,y coordinates as well as the 
text from the fields to create and other some other file types. 

>> What was the first question? You've presented some code.
>> Does it work? Or is there a problem with it?
>> It's hard to tell because it's written in VB.NET,
>> and I don't know VB.NET. If also failed to find a question.
>> 

> I would like to fire an event to iterate through the rows and columns
> of pdfptable  to get celltext as well as coordinates.
> 
> This satisfies 2 of my needs:
> 
> 1.       With x,y coordinates I can write lines and dividers back to
> report based on key words
> 
> 2.       I create Excel and HTML files from table data
> 
> The examples I find are far more complex than I need to accomplish my
> simple need.
> Here is code I have so far.  It is written in VB.NET but I can convert
> C# to VB.NET
> 
> 
> ' Using Itextsharp not itext so some methods may differ
> 
> Public Sub CreatePDF()
>     Dim doc As New Document
>     PdfWriter.GetInstance(doc, New FileStream("myfile.pdf",
> FileMode.Create))
>     doc.Open()
>     Dim my_pdf_tbl As PdfPTable
>     my_pdf_tbl = New PdfPTable(3)   ' contains 3 rows
>     my_pdf_tbl.WidthPercentage = 100.0F
>     my_pdf_tbl.DefaultCell.Border = PdfCell.NO_BORDER
>     my_pdf_tbl.AddCell("Date")
>     my_pdf_tbl.AddCell("Sales")
>     my_pdf_tbl.AddCell("Guests")
>     my_pdf_tbl.HeaderRows = True    'End of table header
>     my_pdf_tbl.AddCell("0/21/2009")
>     my_pdf_tbl.AddCell("2345.09")
>     my_pdf_tbl.AddCell("17")
>     my_pdf_tbl.AddCell("0/21/2009")
>     my_pdf_tbl.AddCell("2345.09")
>     my_pdf_tbl.AddCell("17")
>     doc.Add(my_pdf_tbl)
>     Dim myevent As New PdfPTableEvents
>     my_pdf_tbl.setTableEvent(myevent)
>     ' add the table with document add
>     doc.Add(my_pdf_tbl)
>      ' add the table at an absolute position
>     my_pdf_tbl.WriteSelectedRows(0, -1, 100, 600,
> PdfWriter.getdirectcontent
>     doc.Close()
> End Sub
> 
> Public Class PdfPTableEvents
>     Implements PdfPTableEvent
>     '
>     Public Sub tableLayout(ByVal table As PdfPTable, ByVal width()() As
> Double, ByVal height()() As Double)
>         Dim sOutputTemplate As String = " Text is {0} : x-pos is {1} :
> y-pos is {2} : cell height is {3} : cell width is {4}"
>         For i As Integer = 0 To 3
>             For j As Integer = 0 To 3
>                 ' I will write Values to Excel file here
>                debug.Writeline(string.Format(sOutputTemplate, text, x,
> y, width, height)
>             Next j
>         Next i
>     End Sub
> 
> End Class
> 

 [rodney.williams] 
Yes, the calculations are done by the program and are placed in the PDF Table. 
I can't find examples anywhere of continuous horizontal scroll as you would do 
in Excel. This is not related to the first question. 

> If you calculate the totals in your code, then it's possible.
> iText isn't Excel. You can create complex reports, but you have
> to do the math in your code.
>> I am trying to persuade upper management that they will not lose
>> features if we migrate from Excel to  PDF instead
>> In one report there are 50  columns of  totals for each  of their
>> stores which they can read by simply moving horizontal scroll bar to
> the last column in Excel.
>> Can I accomplish the same with Itext/sharp?


 *

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to