Free Support Forum - aspose.com

0365 Word doc in list replace text and convert

I have a list in sharepoint online (O365). This is a word template (or could be a doc). I need to find a way to convert this template doc through javascript to a pdf and a new completed work document. So workflow for code would be read data from various lists in sharepoint to get source data. Load word template (or doc) from sharepoint list, find all occorrences in the document and replace with data from other lists. Data could be multi lined, formatted RTF etc and this should be what would appear in the document. Then this document should be saved back to a sharepoint document list and converted to a secure PDF and that added to the same list. This needs to be done in javascript. Code for getting data I am fine with, but not for getting the template, replacing the document with the data, converting it to pdf and saving back. items to find in the document template are of the format {[key=“CODE”,[dataitem]}. Where key is a reference item in the source data for a record and [dataitem] is one or more elements of the record which could be multiple paragraphs of text or rtf data. more examples would be {[key=“SG.1”,“the data is” + [content1] + [content2]]} or {[key=“SG.1.1”,[title] + " " + "[content1]]}

I am looking to see if this product could enable me to do this, or for alternatives?

Thanks

Hi Chris,


Thanks for your interest in Aspose.Words. You can meet these requirements using Aspose.Words for .NET API. However, I am afraid, you can’t manipulate Word documents using Javascript instead you may use C# or VB.NET.
http://www.aspose.com/docs/display/wordsnet/Introducing+Aspose.Words+for+.NET

Here is how you can integrate Aspose.Words for .NET with Sharepoint environment. For this, I would suggest you please go through the following blog post and video tutorial:
Using Aspose.Total for .NET with SharePoint for File Creation and Manipulation.

Regarding finding content in Word document and replacing it with new content, please refer to the following articles:
http://www.aspose.com/docs/display/wordsnet/Find+and+Replace+Overview
http://www.aspose.com/docs/display/wordsnet/How+to+Find+and+Highlight+Text

Converting the final/modified document to Pdf is also easy:
http://www.aspose.com/docs/display/wordsnet/How+to++Convert+a+Document+to+PDF

Please let me know if I can be of any further assistance.

Best regards,