Hi there,
I use Aspose.Word to generate documents off templates, when I have a large text field in the template, Aspose generates the document correctly in DOC format but nothing comes out in PDF format. I’ve attached my test app and the template in a zip file.
The code is pretty straight forward, below is the code snippet.
I have a large string about 5000 characters in length, and template just have one merge field. when I use SaveFormat.Doc, it works fine; when I change it to SaveFormat.Pdf, the generated document shows an empty table cell. I’ve also attached screenshot for Aspose.Word version info and the output I’ve observed.
string aa = @“1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789a”;
Document doc = new Document(@“c:\downloads\testtemplate.doc”);
// Fill the fields in the document with user data.
doc.MailMerge.Execute(
new string[] { “TestField” },
new object[] { aa });
doc.Save(@“c:\downloads\test.out.pdf”, SaveFormat.Pdf);
thanks
Hi Hui,
Thanks for the reply, I am not sure if I could update to latest version at the moment, could you confirm this is a bug in v11.2 and in which version did this get fixed?
thx
Hi Hui,
Hi there,
I’ve upgraded to v14.1, now one of my report is crashing. I wrote a demo code to reproduce it.
this test app doesn’t output anything, it just does the merge. With the version I previously used(v11.2) this code will work just fine, but with 14.1, it crashes at MailMerge.Execute
stack trace is like the following. it doesn’t show any useful information, please take a look
thx
Failures:
1) xxxx : System.NullReferenceException :
Object reference not set to an instance of an object.
Server stack trace:
at xe86f37adaccef1c3.xc5c3f438428cb03b.x446c2c253cdada74(x561fa53c007d3597 xe01ae93d9fe5a880)
at xe86f37adaccef1c3.xc5c3f438428cb03b.xb7e46440d2a34d6d(x561fa53c007d3597 xe01ae93d9fe5a880, FieldMergingArgs& xfbf34718e704c6bc)
at xfbd1009a0cbb9842.x561fa53c007d3597.x67bf65e8693cdf2e(xc5c3f438428cb03b xa4d52e34b62b5495, MailMerge x2a99de81295e7f29)
at xfbd1009a0cbb9842.xfedf115fd9c03862.xc0425e9d15f16649(Field xe01ae93d9fe5a880)
at xfbd1009a0cbb9842.xfedf115fd9c03862.x652f6183bc2805f1(Field xe01ae93d9fe5a880)
at xfbd1009a0cbb9842.xfedf115fd9c03862.x0f4b7f3b2ee62d4b(x5e36356bc92c609b x0f7b23d1c393aed9)
at xfbd1009a0cbb9842.xfedf115fd9c03862.x4e3cfc222c92cda7(x5e36356bc92c609b x0f7b23d1c393aed9)
at xfbd1009a0cbb9842.xfedf115fd9c03862.x92fd9b2325a0103b(x5e36356bc92c609b x0f7b23d1c393aed9)
at xfbd1009a0cbb9842.xfedf115fd9c03862.x945dc04ac4e4f5ab(xb0b76bad05a97c8b xd3311d815ca25f02)
at xfbd1009a0cbb9842.xfedf115fd9c03862.x7b62f4210c900502(xcf417e2db4fe9ed3 xb1a1ccf3b9674a87, xcf417e2db4fe9ed3 x8f8ce337d74845ae)
at xe86f37adaccef1c3.xc5c3f438428cb03b.xdeeb682062ef79a5()
at xe86f37adaccef1c3.xc5c3f438428cb03b.xd5da23b762ce52a2(xa11a4c48b53f49a6 xef1769c4fe6ae4ca, Boolean xc9c7b90943167aed)
at Aspose.Words.Reporting.MailMerge.x18dfca7c5fd2402f(xa11a4c48b53f49a6 xef1769c4fe6ae4ca)
Hi Hui,