We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to save as pdf and then update table cells using aspose.words V9.3 and .pdf

I started out a project using aspose.pdf. But, the formating was not as easy as I would like. My next attempt has been to format the document in word with tables that will be updated using linq. The examples in Aspose show this can be done with an intermediate save as xml and then using pdf.GetObjectbyID to find the correct object and updating the pdf. But, in the latest version of .words (9.3 downloaded yesterday), save as xml does not create a readable file that I can find the correct objectID to update. I can't find any example of how to do this in the newer version. Do I have to use an older version to update? Is there a better way? I want to use your product, but am pretty frustrated right now, and I don't want to spend any more time in the newer version if I can only do it in an older version. Thanks.

Judy Wilkinson

Hi Judy,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please provide me more information about your requirements? What do you mean when say “update table cells”? Could you please attach your input and expected output here for testing? I will investigate it on my side and provide you more information.

Best regards,

Attached is a word doc that I want to update tables using c# in visual studio (V2010) using linq queries and program.cs with my code. I've been following the Rental Property table example from the Aspose site. I hope this gives you enough information. I was manually trying to set the data (not from the linq queries) in this test example just to see if it works.

http://www.aspose.com/documentation/.net-components/aspose.pdf-for-.net/use-aspose-word-to-create-xml-template.html

Hi Judy,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for your interest in Aspose.Words and additional information. I think the best way to fill the document with data is using Mail Merge feature. Please follow this link to learn more: http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/simple-mail-merge-explained.html

Or you can use Mail Merge with regions. Please see the following link:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/mail-merge-with-regions-explained.html

I little bit modified your template document and attached it here. Please try using the following code to fill this template with data:

Document doc = new Document("TestInvoiceLayoutForAspose.doc");

string[] fieldNames = { "InvoiceDate", "PolicyNumber", "AlphaCode", "PolicyEffectiveDate", "PaymentDueDate", "Content", "PremiumDueDate" };

string[] fieldValues = { "Test1", "Test2", "Test3", "Test4", "Test5", "Test6", "Test7"};

doc.MailMerge.Execute(fieldNames, fieldValues);

// Save to DOC

doc.Save("out.doc", SaveFormat.Doc);

// Save to PDF

doc.Save("out.pdf", SaveFormat.Pdf);

Hope this helps.

Best regards,

Thanks for your response. I'm going to give it a try. But, I didn't get the attchment with your revised document (TestInvoiceLayoutForAspose.doc). Can you resend it? I'll let you know if this works for me ... it certainly sounds promising. Thanks.

Judy

Hi Judy,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I sent the modified template document and the output document to your e-mail.

Best regards,