We are about to start evaluating Aspose.Words today for a project and have a few basic questions. I saw some of the answers scattered around the forums but for completeness I’ll ask them here anyway:
- We need to be able to take RTF snippets (using RTF encoding") and merge those blocks into a “Word” document through merge fields - can this be done? My big concern is taking the RTF block with its formatting and integrating that with the document.
- Can I add/remove merge fields through Aspose.Words into a document?
- Is there a plan to support WordML still and how do you forsee this effecting your previous releases of the component?
- Yes, you can insert parts of the MS Word document (it can be rtf template documents) into the other documents. This process can be combined with merge fields execution with some amount of additional user coding.
- You can add/remove merge fields to/from document using Aspose.Words. Look for description of DocumentBuilder.InsertField method in Aspose.Words API Reference.
- We have plans to support WordML in the near future, but I don’t have any timeline just yet.
Thank you for the quick response, one last question in regards to the RTF, do they have to be RTF files or can I work with them at the “string” or “stream” level?
Well, i can’t use HTML because there are at a best case slight differences and the format of the document must be exact.
What are the options then?
Can I create multiple instances of a DocumentBuilder, one for the master and then subsequent ones for the rtf streams and simulate that the rtf streams are files? If so how does that effect memory and performance?
I have a database with various RTF encoded blocks of text.
I have a master document in Word that has merge fields
What I need to do is:
Get a list ofthe “merge” fields from the Word doc
Iterate through that list and retreive the corresponding RTF snippet (there may be a point where I have to regex “psuedo” tags into actual “merge” tags (so in essence I need to read the RTF block and convert to a word format and embed it into the master). As a note, this may be a recursive exercise where I have to do this within a block of RTF also.
Basically, I need to build a template of templates to produce the “master” template. From that point I can use your component to actually “merge” the data only.
Ideally I’d like the ability to intermix both Word “doc” type snippets and RTF type snippets into some sort of master document - again, ideally Word 2003.
Can I take the RTF text and stream it in to the DocumentBuilder as a “doc” type?
Maybe I would have to generate temp files for each block so that I can load it?
Reason i’m asking is because I created a RTF file and saved as a doc from Wordpad then openend in Word and vice versa. I lose stuff like fields if I save back again from wordpad but the format of the file seems to remain relatively the same between the two apps.
Yes, that makes perfect sense. The bad news is that Aspose.Word cannot deal with rtf right now. This feature will be available only in 2-3 months from now. So we cannot actually read and embed rtf snippets from database into word document now.
Please come again in a few months when we’ll have this functionality implemented.