Free Support Forum - aspose.com

Document Collection

Hi,
Do we have any alternative for Microsoft Application.Documents in Aspose.

@ashkmr42,

You can mimic this by using the following code:

// A Collection to hold opened documents
ArrayList arrDocuments = new ArrayList();

// open document 1
Document doc1 = new Document(dataDir + fileName);
arrDocuments.Add(doc1);
// open document 2
Document doc2 = new Document(dataDir + fileName);
arrDocuments.Add(doc2);
// open document 3
Document doc3 = new Document(dataDir + fileName);
arrDocuments.Add(doc3);
// open document 4
Document doc4 = new Document(dataDir + fileName);
arrDocuments.Add(doc4);
// open document 5
Document doc5 = new Document(dataDir + fileName);
arrDocuments.Add(doc5);

foreach(Document document in arrDocuments)
{
    // your code
}

Also, please refer to the Aspose.Words for .NET API.

Following are the links to some useful resources you may need to accomplish your tasks.

Hi @awais.hafeez
Thanks for the reply. I am Using Microsoft Interop to close the word documents which are running on the PC.

WordDocumentCollection = WordApplication.Documents
WordDocumentCollection .Item(DocumentIndex).Close();

Is their any alternative to convert this in Aspose.

@ashkmr42,

I am afraid, the requested feature is out of the scope of Aspose.Words for .NET API. If document is opened in Word application, Aspose.Words for .NET can not close it or interact with it. If we can help you with anything else, please feel free to ask.