Partitioning Word Document


#1

Hello,

Any assistance in solving my problem would be greatly appreciated. I want to input large MS Word Documents, say 400 pages, and partition them into a number of small documents (3 pages each for example) while retaining formatting. What is the best way to approach this problem? I believe I could use the DocumentBuilder to build smaller files from sections of the larger file if section breaks existed. How can I insert continuous section breaks at regular intervals?

Thanks in advance.




#2

To copy contents from one document to another you should basically use Document.ImportNode method. It allows you to copy document node by node (not necessarily on section basis) with the option to keep source formatting.

To insert section break you need to position DocumentBuilder using one of its MoveTo methods and use InsertBreak to break document into section at this point.

The concrete coding strategy depends on the rule by which you want to break your source document.