Free Support Forum - aspose.com

Questions regarding aspose.word

Hello,

Our organization wishes to gain some information about your product, Aspose.word. Here are a few questions that we have.

1. Does aspose.word support datasets of multiple records? eg. We need to be able to print 300 letters from one template into one word document.

2. Is it possible for aspose.word to send directly to the printer, as opposed to bringing up the “viewable” document?

3. We will be storing our template files on one of our servers (application/web server or on a SQL server machine). Users on some of the client machines will need to be able to modify the template files and save them back to the original directory/database. Do you have a method or a suggestion of how to manage this issue with aspose.word?

4. Can aspose.word be altered to append a merged file to a word document (on the server) instead of displaying the file to the user?

Thanks,
Scott

Hi Zoltar,

1. Datasets and mail merge of multiple records into one document is going to be supported in Aspose.Word 1.1 scheduled for release next week.

2. At the moment Aspose.Word cannot send to the printer and it cannot show the viewable document. You still need either MS Word, or some other application like Word Viewer to view or print the document. You might be able to work something around for printing by invoking WordPad or maybe even Word Viewer from your app. We might look into developing a viewing and priting control later, but this is not yet certain.

3. Aspose.Word can load and save documents from a stream. So you can store store your document in a binary field of a database. You can use Aspose.Word to extract document from a database and save to disk and fire up MS Word to edit it and then do reverse to put the document back into the database. Asposr.Word allows to modify template files, but only to some extent, at the moment it allows to delete sections and perform mail merge.

4. We might be able to add this feature reasonably quickly. I can probably generalize it a little. For example, we’ve recently added API to delete any section from a document. Will it be enough for you if there was an API that allows to copy section from one document to another? In this case you do a mail merge as it does now, but then just copy the result to the end of another document. You send a sample source and destination files to word@aspose.com and I will have a look.

Thanks for your quick response, romank.

In regards to #4, I would like to give you a scenario in which this would be used:

A user will select any number of templates that need to be printed.
After submitting, we want to be able to create a new file probably located on the server(naming it uniquely to that user and/or date). Then, the first mail merge will occur and save the merged document to the new file. Any subsequent templates that need to be merged will be appended to the end of the file with page breaks set in between. All of this being transparent to the user until the end file is displayed (using word or some other viewer).

In addition to this, I read another post regarding “pdf” output. It would be great if the above file that we are appending to could be a “pdf”. Our users will have adobe reader on their client machines and will not have Office installed.

Please let us know if you can accommodate for our requests.

I am also available on AIM. My user name is Zoltar1111.

Scott

It seems like your request comes down to two features:

1. An API to copy sections from one document to another will solve your problem nicely. The reason I’m talking about sections - it is the only granularity of manipulating document content we support now and therefore the feature you are asking can be added quicker. We will add this feature, it is very well inline with our direction of evolving the API.

2. Aspose.Word being able to produce Pdf output. This feature is high on the priority list for us. You will need to have both components Aspose.Word and Aspose.Pdf (maybe they will be available as one Aspose.Report component).

So you can count on that both of these features will be included. Estimated timeframe 2-3 months. Maybe section copying could be included in the release next month, but I cannot tell now.

Dear Scott,

For integration with Pdf or Excel, feel free to post your feature requests in the forum, Aspose.Report as Aspose.Report is a new product that integrates Aspose.Word, Aspose.Excel, Aspose.Pdf and probably Aspose.Chart.

Thanks again for all your quick responses.

Will the features that you have said you will add to aspose.word be also added to the new aspose.report?

I just would like to know if I need to post my original requests on the other board.

Thanks,
Scott

Dear Scott,

It’s better for you to post at Aspose.Report for integration issues of all existing reporting products such as Aspose.Word, Aspose.Excel, Aspose.Pdf and Aspose.Chart.

Thanks for your cooperation.

Hi Scott,

Latest release Aspose.Word 1.1 supports DataTable as data source for mail merge operations, check out http://www.aspose.com/forums/ShowPost.aspx?PostID=3710.

I recently discovered your product while doing some research for a project that requires the functionality mentioned in item 1 of the original post on this thread. - the ability to merge 10s or 100s of letters from one template on the server into one word document for printing on the client. I’m new to .NET, is there an example or some code available that I can use to demonstrate this for my client?

Thanks!

Hi Scot,

It is certainly possible to do using Aspose.Word. All you will need to do is to get your data in DataTable and pass it into MailMerge.Execute() method. This will create an output document which you can save to a file or send to the client browser.

You can see a working demo here http://www.aspose.com/Products/Aspose.Word/Demos/.

Personalized Letter demo does just that, but only for a single record. For Multiple record mail merge demos see two other demos Customer Labels and Invoice and you will get an idea. By supplying DataTable instead of array of strings it will merge multiple times into the same document.

You can download evaluation version of Aspose.Word for free from here http://www.aspose.com/Downloads.aspx. The evaluation version has no expiry date, it just outputs watermark at the top of the document. The evaluation version includes source code for the online demo mentioned above.

You can also check out documentation for Aspose.Word here http://www.aspose.com/Products/Aspose.Word/Api/Aspose.Word.html. Most likely you will be interested in this method http://www.aspose.com/Products/Aspose.Word/Api/Aspose.Word.MailMerge.Execute2.html.

Let me know if you need other help.

I really appreciate your quick response and an excellent product. I was easily able to create a demo that works very well and you now have another satisfied customer.

Thank you!

Hi Roman,
You posted the following:
"You can use Aspose.Word to extract document from a database and save to disk and fire up MS Word to edit it and then do reverse to put the document back into the database"

Can you provide a code example of how this would work ?
Thanks,
Mike

Hi Mike,

We don’t have a ready code example for this, but my idea was:
1. You need a BLOB (binary) field in the database. Lookup in .NET documentation how to read and write data to BLOB fields.
2. Use Document.Save which takes Stream as a parameter to save a document to the BLOB field.
3. Use Word.Open method which takes Stream as a parameter to load documents from a BLOB field.
4. To fire up MS Word you can either use MS Word automation or invoke some sort of shell execute method that takes MyFileName.doc and fires up MS Word for it. Again, check in .NET documentation what’s available.

Let me know if it is critical for you to have a working code example.

Hi Roman,
Thanks for your reply. Unfortunately it is critical for me to have a code example as I’m running into a deadline tomorrow.
Basically I need to load a Word document from the web server (or create it if it doesn’t exist), allow the user to edit it and then save the document back to the web server (or database). This is an Intranet application, so having the document on a shared LAN drive is also possible.
Any code example you have that does this, whether it be by a Stream or some other means, would be extremely helpful.
Thanks,
Mike

Hi Mike,

Strictly speaking uploading and downloading files to a webserver is not part of Aspose.Word, you should just use .NET Framework classes to do that. So you best bet will be to read the documentation and search for tips on the internet, for example www.dotnet247.com. I can provide some initial tips here:

A way to load a document from a webserver was discussed in URI Format.

Similar approach for loading an image file (can be applied to a document file as well) was discussed in Insert an image from file.

For examples on how to work with Aspose.Word classes in general, please see the API Documentation. Many important classes and methods have code examples in the documentation, although not all.

For uploading image to the webserver, please see HttpPostedFile and related classes in .NET Documentation. I used it on another project to upload a product image to the webserver.

Dear Mike,

Please check Consulting service preview: rapid implmentation based on Aspose products.

Thanks.

Hi all,

Check out Aspose.Word 1.6 can be used together with Aspose.Pdf to convert DOC files to PDF.