Free Support Forum - aspose.com

Concatenation of existing DOC/RTF files

Does Aspose.Word support concatenation of existing word/rtf documents?

If so, is the concatenation memory based or disk based? A typical scenario would be to concatenate between 2 and 30 documents into one word document. The resulting word document MUST be compatible back to Word 97*. We are doing this server side and possibly doing it real-time. With 20 or 30 clients hitting our servers at once, we would obviously like to use as little memory as possible per-request while we stream back the document in chunks.

If this is possible, is it possible to download an evaluation version to see if the performance/resulting size is acceptable?

Many thanks in advance,

Steve.

* - A lot of our clients are in the finance/legal sector, hence Word 97, as they’re a bit hard up! :slight_smile:

Hi Steve,

1. Once document is opened everything happens in memory at the moment, no disk operations are performed until save into file is requested. Technically speaking we read and write files always in Word97 format and just benefit that more recent formats are backwards compatible.

2. Document concatenation is possible using Aspose.Word. You need to do this by moving/copying Section objects (Document.Sections[x]).

3. For your scenario it is better to move sections between documents to conserve memory. This will work because move will only occur in memory and if you don’t save the original document it will not be modified.

Please check related discussion http://www.aspose.com/forums/ShowPost.aspx?PostID=5910.

Please note that in the current release Aspose.Word 1.3.4 moving sections with drawing objects between documents is not supported in all scenarios. This will be fully supported in the next release due out in just a few days.

We also have made some improvements regarding memory utilization that will go out in the new release. If you are not happy with memory usage, please report back and we will work on this more.

You can download evaluation version here http://www.aspose.com/Products/Aspose.Word/Downloads.html.

Hi Roman,

Does v1.4 now support copying/moving sections with drawing objects too?

Thanks.
Abdim

Hi Abdim,

Yes, it does support copying and moving within and between documents.

But be aware there still could be some issues, I’ll try to explain what to watch out for:
1. Grouped shapes are not supported. It will throw an exception with a suitable message.
2. If you had shapes connected, the connectors might be messed up after moving shapes around.

All of these issues are related to internal shape identifiers and they are quite complex in Word so we don’t fully handle them yet.

It is pretty stable now and we will improve it even further in the future.

Hi there,
I tried moving moving documents sections from one document to the other, but when moving more than one document into another, the process is horrendously slow and consumes a H U U U U G E amount of memory (so much so that my 512MB machine died). I was concatenating several documents of around 10MB each (some with graphics, some without).
I compared this with automation and sadly, automation won hands down in both speed and memory consumption.

Hi Steve,

You are right, combining 10mb files is a bit too much for Aspose.Word as it stands right now. The biggest file we were testing with was 1.4mb and 115 pages long.

Did you move or copy section from one document to another? Moving means remove section from one document and add to the other and it will be much faster and easier on memory than copying.

We will be interested to obtain some of your files so we can do more performance improvements, you are welcome to email them to word@aspose.com.

Hi Steve,

Thanks, I’ve got the files.

We will perform another round of optimization before end of May. Your observations were correct, Aspose.Word creates too many small objects during loading of a file and it does not need them after that so that’s why forced garbage collection helps.