Free Support Forum - aspose.com

Adding Removing Pages

I’m strongly considering APOSE.Word for a project but need one additional feature, the ability to remove pages. In my client’s application, a proposal generator, I need the ability to customize a word document through mail merge and remove redundant or unnecissary pages from the proposal based on specefied varaibles. Can your assembly do this? Can someone recomend one that can?

Also, does it matter what version of a Word document I peform a data marge against? I’m on a Mac using MS Word X, will that matter? Word XP vs Word 200…does that matter?
-Jason

Hi Jason,

1. At the moment Aspose.Word can read and write Word XP, Word 2000 and Word 97 formats and Word 2003. There is a possibility to include support for earlier versions than Word 97 and for Word for Mac.

2. In the current version it is not possible to add or remove pages or any other document content. Aspose plans to develop and expose a rich API that will allow to build and manipulate document content. The full API will not be available for several months. However if you only need to delete pages or maybe even delete any document content (paragraphs, sections, table rows etc) we might be able to include this feature quickly in the next release (3-4 weeks away).

Can you please send us one of your Word for Mac files to word@aspose.com so we can test it, maybe support for Mac and deleting content can be included reasonably quickly. Please also specify which part of the document you want to delete.

Thanks for the quick reply.

I’ll send a Mac Word Document that containts a Mail Merge letter. From my testing so far i t appears that a Mac Word doc is the same as the PC. Keep an eye out for the email in the next few minutes.

All I need is the ability to delete a page by page number, but the additional ability of removing by paragpahs would be a great addition. If you can get me a quick release in the next few weeks I would truly appreciate it…even a beta so I continue with development.

-Jason

Hi Jason,

Thanks for the file. I had to make some changes to get it to work with Mac document.

Also I have identified a way to delete pages. The problem is that Word document does not really store information in pages and it is paginated only in MS Word. But there is a workaround: you will need to insert extra section breaks to create sections that Aspose.Word can delete. Section breaks in Word are pretty flexible, they can be continous or start from next page. I’ve tried and I think they work very well for your purpose. The code will look like MS Word Object model:

//To delete 3rd section which might correspond to a page if you make it that way.
doc.Sections[2].Range.Delete();

We are working on some other planned features too, but I’ll see if we can do a beta version around 4th January so you can continue with development.

Hi Jason,

We’ve released Aspose.Word 1.1 Beta. You can download it from here http://www.aspose.com/Products/Aspose.Word/Releases/Aspose.Word.1.1.Beta.msi.

I’ve also updated online documentation.

The features you might be interested in are:
1. Can read Word documents created on Mac.

2. Exposes API to delete sections from a Word document. If you put section marks in a way to frame pages you want to be able to delete, deleting a section will delete the page(s) you want. Code example is in the previous topic, let me know if you need more details.

Hi Jason,

Aspose.Word 1.1 is out and supports many of the features you requested. Check out http://www.aspose.com/forums/ShowPost.aspx?PostID=3710.