PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Jun 23, 2018 11:57 am

All times are UTC

Forum rules

Please read this before posting on this forum: Forum Rules

Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sun Mar 09, 2014 1:03 pm 

Joined: Fri Mar 07, 2014 8:52 am
Posts: 2
For some page configuration
NullReferenceException (Object reference not set to an instance of an object.)
occurs in
MigraDoc.Rendering.TableRenderer.InitFormat(Area area, FormatInfo previousFormatInfo)
MigraDoc.Rendering.TableRenderer.Format(Area area, FormatInfo previousFormatInfo)
MigraDoc.Rendering.TopDownFormatter.FormatOnAreas(XGraphics gfx, Boolean topLevel)
MigraDoc.Rendering.FormattedDocument.Format(XGraphics gfx)

in code like this
document = CreateDocument(... some params ...);
MigraDoc.Rendering.DocumentRenderer docRenderer = new DocumentRenderer(document);

I was able to reproduce this bug in console C# application with "PDFSharp + MigraDoc" installed via NuGet
using MigraDoc.DocumentObjectModel;
using MigraDoc.DocumentObjectModel.Tables;
using MigraDoc.Rendering;
using PdfSharp.Pdf;
using System.Diagnostics;

namespace PDFSharpTest
    class Program
        static void Main(string[] args)
            var doc = new Document();
            Section section = doc.AddSection();

            var table = section.AddTable();
            table.Borders.Width = 0.25;


            Row row;
            row = table.AddRow(); // row 1
                row.Cells[0].AddParagraph("Item 11");
                row.Cells[0].MergeDown = 5;

                row.Cells[1].AddParagraph("Item 21");
                row.Cells[1].MergeDown = 1;

                row.Cells[2].AddParagraph("Item 31");
                row.Cells[2].MergeDown = 2;

            row = table.AddRow(); // row 2

            row = table.AddRow(); // row 3
                row.Cells[1].AddParagraph("Item 23");
                row.Cells[1].MergeDown = 1;

            row = table.AddRow(); // row 4
                row.Cells[2].AddParagraph("Item 34");
                row.Cells[2].MergeDown = 2;

            row = table.AddRow(); // row 5
                row.Cells[1].AddParagraph("Item 25");
                row.Cells[1].MergeDown = 1;

            row = table.AddRow(); // row 6

            var pdfRenderer = new PdfDocumentRenderer(true, PdfFontEmbedding.Always);
            pdfRenderer.Document = doc;
            // ...and start a viewer.

An unhandled exception of type 'System.NullReferenceException' occurred in MigraDoc.Rendering.dll
Additional information: Object reference not set to an instance of an object.

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC

Who is online

Users browsing this forum: No registered users and 6 guests

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 post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group