Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2010 PDFsharp.dll

$
0
0
Hello to all and realy thanks for help. Does anyone have some experience on PDFsharp.dll, it is packet to create PDF in Visual Basic. Here is link of dll. http://www.pdfsharp.com/PDFsharp/ind...d=54&Itemid=64

Here is my problem, how to put datagridview for PDF, e.g. for simple text you put: e.DrawString(Me.EmailTextBox.Text, font5, XBrushes.Black, 117, 1055)

For datagridview I put this code:
Code:

        With DataGridView1
            Dim fmt As StringFormat = New StringFormat(StringFormatFlags.LineLimit)
            fmt.LineAlignment = StringAlignment.Center
            fmt.Trimming = StringTrimming.EllipsisCharacter
            Dim y As Single = 395
            Do While mRow < .RowCount
                Dim row As DataGridViewRow = .Rows(mRow)
                Dim x As Single = 85
                Dim h As Single = 0
                For Each cell As DataGridViewCell In row.Cells
                    Dim rc As RectangleF = New RectangleF(x, y, cell.Size.Width, cell.Size.Height)
                    e.DrawRectangle(Pens.White, rc.Left, rc.Top, rc.Width, rc.Height)
                    e.DrawString(Me.DataGridView1.Rows(cell.RowIndex).Cells(cell.ColumnIndex).FormattedValue.ToString(), .Font, XBrushes.Black, rc, fmt)
                    x += rc.Width
                    h = Math.Max(h, rc.Height)
                Next
                newpage = False
                y += h
                mRow += 1
                If y + h > ContentAlignment.BottomCenter Then

                    e.HasMorePages = True
                    mRow -= 1
                    newpage = True
                    Exit Sub
                End If
            Loop
            mRow = 0
        End With

So for first line (in red):
e.DrawString(Me.DataGridView1.Rows(cell.RowIndex).Cells(cell.ColumnIndex).FormattedValue.ToString(), .Font, XBrushes.Black, rc, fmt)
- shows mistake: Error 1 Overload resolution failed because no accessible 'DrawString' can be called with these arguments:
'Public Sub DrawString(text As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, layoutRectangle As PdfSharp.Drawing.XRect, format As PdfSharp.Drawing.XStringFormat)': Value of type 'System.Drawing.StringFormat' cannot be converted to 'PdfSharp.Drawing.XStringFormat'.
'Public Sub DrawString(s As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, layoutRectangle As System.Drawing.RectangleF, format As PdfSharp.Drawing.XStringFormat)': Value of type 'System.Drawing.StringFormat' cannot be converted to 'PdfSharp.Drawing.XStringFormat'.
'Public Sub DrawString(s As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, x As Double, y As Double)': Value of type 'System.Drawing.RectangleF' cannot be converted to 'Double'.
'Public Sub DrawString(s As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, x As Double, y As Double)': Value of type 'System.Drawing.StringFormat' cannot be converted to 'Double'.
'Public Sub DrawString(s As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, point As PdfSharp.Drawing.XPoint, format As PdfSharp.Drawing.XStringFormat)': Value of type 'System.Drawing.RectangleF' cannot be converted to 'PdfSharp.Drawing.XPoint'.
'Public Sub DrawString(s As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, point As PdfSharp.Drawing.XPoint, format As PdfSharp.Drawing.XStringFormat)': Value of type 'System.Drawing.StringFormat' cannot be converted to 'PdfSharp.Drawing.XStringFormat'.
'Public Sub DrawString(s As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, point As System.Drawing.PointF, format As PdfSharp.Drawing.XStringFormat)': Value of type 'System.Drawing.RectangleF' cannot be converted to 'System.Drawing.PointF'.
'Public Sub DrawString(s As String, font As PdfSharp.Drawing.XFont, brush As PdfSharp.Drawing.XBrush, point As System.Drawing.PointF, format As PdfSharp.Drawing.XStringFormat)': Value of type 'System.Drawing.StringFormat' cannot be converted to 'PdfSharp.Drawing.XStringFormat'.

And for second:

e.HasMorePages = True
-shows mistake: Error 2 'HasMorePages' is not a member of 'PdfSharp.Drawing.XGraphics'.

Viewing all articles
Browse latest Browse all 42215

Trending Articles