Section Copy/Duplicate


As Aspose currently does not support the insertion of formatted text, how difficult would it be to duplicate a section (or copy and paste a section).

My problem is this… I have a “block” of text (with formatting) that needs to be repeated several times - the number of times this text is to be repeated varies depending upon the data.

I’m guessing the easiest solution at this stage would be to put that formatted text in a section, which I can continually duplicate, depending upon the data being rendered.

Given that section deletes etc are implemented, how soon do you think it possible to have something like section.duplicate(int sect_no) which inserts another copy of the section right after the given section. More generic would be a section.copy, which you can then either MM or insert the section elsewhere in the doc.




Hi Jat,

I can allow copying sections inside one document quickly, everything is ready for it. It has been requested by other customers too so I’m more than happy to do it.

Do you think it is enough to copy sections inside one document only? It would be more difficult to allow copying sections between documents especially trying to preserve or copy styles between documents.


Within a document is fine for what I currently need to do!



PS I can imagine that some customers would like copying between docs (even it were just generic formatting (font, size, B, I, U), losing ‘style’ information)


Ok, I’ll add this feature in the next few days.

I’ll try to make API for it look like in MS Word Object Model, but I suspect it is a bit clumsy to copy a section in Word, so we might end up with a simpler approach.


Hi Jat,

It is now possible to add, remove and copy sections inside a document and even between documents, check out Aspose.Word 1.2.2.

We didn’t go with MS Word automation API approach. We decided to go with more familar .Net collections approach. As a result you have Sections.Add, Insert, Remove, RemoveAt, Clear and so on methods and you have Section.Clone.

But be careful copying sections between documents. There could be issues if two documents use different styles or if the section you copy contains drawing objects.