Free Support Forum - aspose.com

Aspose.Word Evaluation - Expiry?

Hi,

I’ve just had the strangest experience - I’ve been trying out Aspose.Word for about 2 weeks now (we’ve been trying to see if it can successfully duplicate one of our Crystal generated reports). On Friday I drew a report quite nicely, and today the same code just passes by the MailMerge.ExecuteWithRegions call and the merge fields are not merged in the document at all!! Neither do the merge event handlers get called at all!! And this is the exact same code and data that I used on Friday!

My question therefore is this: Does Aspose.Word expire at all? I know the eval version inserts it’s watermark and garbage text (which is fine for our eval purposes), but nowhere can I find mention of any expiry period.

If anyone could shed some light on this I’d be most grateful!!

Thanks!!

Angela

(PS. I’m using the latest version - Aspose.Word 3.1.6.0)

Hi Angela,

Thank you for considering Aspose.

No, Aspose.Word evaluation version has no expiration date and the watermark and garbage text are its only indications. So try to rebuild the solution and step through the code.

Hi Dmitry,

Thanks for the prompt response.

I’ve tried stepping into the code, and discovered that my merge event handlers aren’t executed at all (I put breaks within the handlers which are never reached. When I open the saved document, I see my orignal template - the merge fields have not been replaced or removed.

Here is the code i’m using:

Document doc = new Document(String.Format(@"{0}\DetailedItinerary.doc", AppDomain.CurrentDomain.BaseDirectory));

_builder.Document = doc;

_builder.Font.Name = “Arial”;

doc.MailMerge.MergeField += new MergeFieldEventHandler(HandleMergeField);

doc.MailMerge.MergeImageField += new MergeImageFieldEventHandler(HandleMergeImageField);

doc.MailMerge.ExecuteWithRegions(_dsData.Tables[“ReportSettings”]);

_fileName = String.Format(@"{0}\DetailedItineraryWordReport.doc", AppDomain.CurrentDomain.BaseDirectory);

doc.Save(_fileName, SaveFormat.FormatDocument);

Here is some of the code from my merge handler:

private void HandleMergeField(object sender, MergeFieldEventArgs e)

{

if (e.FieldName == “HeaderText1”)



Attached is my resulting file - as you can see, there merge fields are still there!

Thanks again for getting back to me so quickly!

Angela

Hi Dmitry,

For now I’ve changed the ExecuteWithRegions to Execute, passing a single datarow instead of a datatable, and it seems to work.

But I still don’t understand why the ExecuteWithRegions should suddenly no longer work, when Friday it worked without a problem (no code changes between Friday and this morning).

Thanks again for all your help!! I really appreciate all the effort you guys put into your support!!

Angela

It’s pretty weird that the merge handler was called previously: you have no merge regions defined in your template so ExecuteWithRegions should never work! I have no rational reasons for this based on what you’ve told. Maybe you used another template before?

That’s the strange part - I have a template with the tablestart and tableend regions defined, and one of the ladies here in the office was trying to draw a demo report to show to a customer (we’re trying to find out if our customers are interested in MS Word based reports), and she also had the template with fully defined regions. She was the one who brought to my attention the fact that the report she was drawing contained no data.

I also had one of the other developers step into the code on his machine with the region-defined template - somehow the merge-handler caught the merge events for the “FooterTex1” and “FooterText2” fields, but not the “HeaderText1” or “HeaderText2” fields, nor for the “Logo” image merge field.

I’ve attached the template I’ve been using all along (the previous attachment was the actual resulting file, not the template itself).

Like I mentioned earlier - the same template, code and data drew a report on Friday and Monday morning, but today the same code/template/data for some reason does not seem to be merging?? But I’ll keep trying different scenarious in hope that I’ll be able to pinpoint some specific point where the merge skips.

Thanks again for all your help!!

Regards

Angela

Hi Dmitry

Seems we’re making some progress Smile - I’ve tried some scenarios and this is what I found:
1 ExecuteWithRegions (DataSet) - success
2 ExecuteWithRegions (DataTable) - no data
3 Execute (DataRow) - success

I tried ExecuteWithRegions(DataTable) with 2 different templates - one with regions defined (TableStart and TableEnd) and one with out. Neither produces any results.

For now I’m passing in the entire dataset, but I’m scared that it might affect speed if the dataset grows too large (some of the cases contain quite a bit of data). As well as the fact that our reporting system resides on a server and is called by a client - passing an entire dataset when I only need one table could affect bandwith if the dataset grows too large.

But for now it seems to be working.

Thanks again for everything!!

Regards

Angela