We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Can Aspose do the following?

We have word documents .doc or .docx that I need to do the following on.

  1. I need to strip out the first page and part of the last page.
  2. I need to rename the document.
  3. I need to somehow show the document in HTML format. The document will have images and they must be viewable somehow.
  4. I need to save the document with the new name in a new location.

We show the document on our webpage in HTML format so the structure of the document must be very close to how it looks in Word. Showing the actual document embedded is not an option, it must be done through HTML due to other constraints we are planning down the road.

Is what I need to have done possible with the free version of Aspose Word or will I need the licensed version?

Additional criteria but not required:

We only want certain clients to see parts of a word document. Say we wrap a paragraph with <client#1> some text </client#1>

Everyone can view that paragraph except Client#1. This would need to carry through if they tried to download the document, it would strip out the content they should not view and allow them to download the document.


Anyone? I’m pretty sure Aspose can do everything I asked but the additional criteria, would really love to know if that is possible.

Hi there,


Thanks for your inquiry. Please note that MS Word document is flow document and does not contain any information about its layout into lines and pages. Therefore, technically there is no “Page” concept in Word document. Pages are created by Microsoft Word on the fly.

In your case you can achieve splitting of document into pages by using the utility methods available in the attached ‘PageNumberFinder’ class. For example, you can use the code like below to extract pages to output html document.

Document doc = new
Document(MyDir + “in.docx”);<o:p></o:p>

// Set up the document which pages will be copied to. Remove the empty section.

Document dstDoc = new Document();

dstDoc.RemoveAllChildren();

PageNumberFinder finder = new PageNumberFinder(doc);

// Split nodes which are found across pages.

finder.SplitNodesAcrossPages(true);

// Copy all content including headers and footers from the specified pages into the destination document.

ArrayList pageSections = finder.RetrieveAllNodesOnPages(2, 5, NodeType.Section);

foreach (Section section in pageSections)

dstDoc.AppendChild(dstDoc.ImportNode(section, true));

dstDoc.Save(MyDir + "Document Out.html");



Moreover, Aspose.Words uses our own Rendering Engine to layout documents into pages.
Please also check using the DocumentLayoutHelper sample from the offline samples pack. This sample demonstrates how to easily work with the layout elements of a document and access the pages, lines, rows, spans etc.

If you want to extract contents from document, please read following documentation link for your kind reference.
http://www.aspose.com/docs/display/wordsnet/How+to++Extract+Selected+Content+Between+Nodes+in+a+Document

Hope this helps you. Please let us know if you have any more queries.