PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ArgumentOutOfRangeException on RenderDocument()

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
Leo



Joined: 17 Apr 2009
Posts: 4

PostPosted: Fri Apr 17, 2009 4:03 pm    Post subject: ArgumentOutOfRangeException on RenderDocument() Reply with quote

Hi to everyone, I'm trying migradoc and pdfsharp in my .NET project. I created a test project with the above code copied and adapted from c# sample. When I try to execute it I receive the ArgumentOutOfRangeException on this line: pdfr.RenderDocument()

Could you help me to find the problem?

Thank you very much!!

Code:

Imports PdfSharp
Imports PdfSharp.Drawing
Imports PdfSharp.Pdf
Imports PdfSharp.Pdf.IO
Imports MigraDoc.DocumentObjectModel
Imports MigraDoc.Rendering
Imports MigraDoc.DocumentObjectModel.Tables

Public Class ReportTest
    Public Sub New()
        Me.create()
    End Sub

    Public Sub create()
        Dim document1 As Document

        document1 = New Document()

        Dim tableBorder As Color = New Color(81, 125, 192)
        Dim tableBlue As Color = New Color(235, 240, 249)
        Dim tableGray As Color = New Color(242, 242, 242)

        document1.Info.Title = "Test report Condotte"
        document1.Info.Author = "Leo"

        Dim style As Style

        style = document1.Styles("Normal")
        style.Font.Name = "Verdana"

        style = document1.Styles.AddStyle("Table", "Normal")
        style.Font.Name = "Verdana"
        style.Font.Size = 10

        Dim t As Table
        Dim section As Section

        section = document1.AddSection()

        t = section.AddTable()
        t.Style = "Table"
        t.Borders.Color = tableBorder
        t.Borders.Width = 0.25
        t.Borders.Left.Width = 0.5
        t.Borders.Right.Width = 0.5
        t.Rows.LeftIndent = 0

        Dim c As Column

        c = t.AddColumn("1cm")
        c.Format.Alignment = ParagraphAlignment.Center

        c = t.AddColumn("5cm")
        c.Format.Alignment = ParagraphAlignment.Center

        c = t.AddColumn("4cm")
        c.Format.Alignment = ParagraphAlignment.Center

        Dim r As Row = t.AddRow()
        r.HeadingFormat = True
        r.Format.Alignment = ParagraphAlignment.Center
        r.Format.Font.Bold = True

        r.Shading.Color = tableBlue

        r.Cells(0).AddParagraph("Item")
        r.Cells(0).Format.Font.Bold = False

        r.Cells(1).AddParagraph("Test Report")
        r.Cells(1).MergeRight = 2


        ' t.SetEdge(0, 0, 6, 2, Edge.Box, BorderStyle.Single, 3, Color.Empty)

        document1.UseCmykColor = True
        Dim pdfr As PdfDocumentRenderer

        pdfr = New PdfDocumentRenderer(True, PdfFontEmbedding.Always)
        pdfr.Document = document1

        pdfr.RenderDocument()

        pdfr.Save("HelloWorld.pdf")
       
    End Sub

End Class
Back to top
View user's profile Send private message
Leo



Joined: 17 Apr 2009
Posts: 4

PostPosted: Mon Apr 20, 2009 10:17 am    Post subject: Reply with quote

I found the problem!
It was my fault on line r.Cells(1).MergeRight = 2. I can't merge 2 cells on right because I have only one.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com