Welcome to the ASP.NET Core feedback portal. We’re happy you’re here! If you have feedback on how to improve the ASP.NET Core, we’d love to hear it!

  • Check out the features or bugs others have reported and vote on your favorites. Feedback will be prioritized based on popularity.
  • If you have feedback that’s not listed yet, submit your own.

Thanks for joining our community and helping improve Syncfusion products!

1
Vote

When converting a word template to PDF, it occasionally throws "object reference not set to an instance of an object" error.


protected override void InvokeCore(ICommandContext context)

        {

            WordDocument finalDocument = new WordDocument();


            foreach (string[] fieldValue in fieldValues)

            {

                WordDocument document = new WordDocument(fileStream, FormatType.Doc);


                //Performs the mail merge.

                document.MailMerge.Execute(fieldNames, fieldValue);

                finalDocument.ImportContent(document);

                document.Dispose();

                document.Close();

            }


            //Saves and closes the document instance

            DocIORenderer render = new DocIORenderer();

            PdfDocument pdfDocument = render.ConvertToPDF(finalDocument);

            render.Dispose();

            finalDocument.Dispose();

            fileStream.Close();


            MemoryStream outputStream = new MemoryStream();

            pdfDocument.Save(outputStream);


            byte[] fileData = outputStream.ToArray();


            pdfDocument.Close();

            outputStream.Close();

            finalDocument.Close();


        }