A document map question about Aspose.Words?For .net?

Hello ,
I’m using the trial version of Aspose.Words(For .net),I wanna know whether could the product obtain the message of the document map of the doc files ?
And if it could get the message ,whether could be edited (add or delete)?

Hi,

Thanks for your inquiry. Please note that Aspose.Words tries to mimic the same behavior as MS Word do. Documents are created/modified by Aspose.Words supports document map. MS Word deal with document map on the fly. E.g if you add or delete the headings in the document, document map automatically updated. For more information about Aspose.Words, please go through the documentation below:
https://docs.aspose.com/words/net/product-overview/

Moreover, Aspose.Words is quite different from the Microsoft Word Object Model in that it represents the document as a tree of objects more like an XML DOM tree. If you worked with any XML DOM library you will find it is easy to understand and work with Aspose.Words.

Hope this answers your query. Please let us know if you have any more queries.

I wanna know whether could the product obtain the message of the
document map of the doc files ?
do you have a Example?

I had setting the document map in my doc file ,I wanna know how to obtain the document map and it’s page number ?

Hi,

Please accept my apologies for your inconvenience.

Thanks for your inquiry. The Aspose.Words Document Object Model (DOM) is an in-memory representation of a Word document. The Aspose.Words DOM allows you to programmatically read, manipulate and modify content and formatting of a Word document.

You can get the nodes of document map by using following code snippet.

Document doc = new Document(MyDir + "in.docx");

ArrayList documentMap = GetDocumentMap(doc);
foreach (Paragraph para in documentMap)
{
    Console.WriteLine(para.ToString(SaveFormat.Text));
}
private static ArrayList GetDocumentMap(Document doc)
{
    ArrayList nodes = new ArrayList();
    foreach (Paragraph para in doc.GetChildNodes(NodeType.Paragraph, true))
    {
        if (para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading1 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading2 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading3 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading4 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading5 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading6 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading7 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading8 ||
        para.ParagraphFormat.StyleIdentifier == StyleIdentifier.Heading9)
        {
            nodes.Add(para);
        }
    }
    return nodes;
}

Regarding page number, please note that MS Word documents are flow documents and are not natively laid out into lines and pages. The page numbers are represented by a PAGE field in MS Word documents and this field is related to the page layout algorithms in Aspose.Words.When you open a document with MS Word, it calculates the numbers on the fly.

However, I think, you can achieve this by using the utility method available in the attached ‘PageNumberFinder’ class.

PageNumberFinder finder = new PageNumberFinder(doc);
int page = finder.GetPage(doc.LastChild);

Please check the following code example for your kind reference.
    

Document doc = new Document(MyDir + "in.docx");
ArrayList documentMap = GetDocumentMap(doc);
PageNumberFinder finder = new PageNumberFinder(doc);
foreach (Paragraph para in documentMap)
{
    Console.WriteLine(para.ToString(SaveFormat.Text));
    int page = finder.GetPage(para);
}

Thank you, another question。
According to the page number to a doc document is split into a plurality of doc document? Retention of the original page and document format. And how many DOC documents are merged into one?
Aspose word for .Net

Hi,

Thanks for your inquiry. I have tried to understand your query but unfortunately I have not completely understood your query. It would be great if you please share some more information about your query.

There is no limit of documents to merge into one document. Please note that the document needs to be held wholly in memory. Therefore, memory and CPU usage are dependent on document size and document complexity.

I need a demo :
I wanna divided a doc file with many pages into several doc files ,the new doc files keep the same page and document formats as the old file ;Do the Aspose word for .net have any sample like what I want ?
And could it be realized if several doc files merged into one file?

Hi,

Thanks for sharing the details.

g18070414:
I wanna divided a doc file with many pages into several doc files ,the new doc files keep the same page and document formats as the old file ;Do the Aspose word for .net have any sample like what I want ?

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. So, it is not possible to divide specific pages into new documents by using Aspose.Words at the moment.

However, you can extract the contents from document and save the extracted contents to new document. Please read the following documentation link for your kind reference.
https://docs.aspose.com/words/net/how-to-extract-selected-content-between-nodes-in-a-document/

g18070414:
And could it be realized if several doc files merged into one file?

Yes, you can merge several documents to into one file. Please use Document.AppendDocument method to merge documents. This method appends the specified document to the end of this document.

https://docs.aspose.com/words/net/insert-and-append-documents/
https://reference.aspose.com/words/net/aspose.words/importformatmode/

// The document that the content will be appended to.
Document dstDoc = new Document(MyDir + "Document.doc");
// The document to append.
Document srcDoc = new Document(MyDir + "DocumentBuilder.doc");
// Append the source document to the destination document.
// Pass format mode to retain the original formatting of the source document when importing it.
dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);
// Save the document.
dstDoc.Save(MyDir + "Document.AppendDocument Out.doc");

The issues you have found earlier (filed as WORDSNET-2978) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)