ZennoLab Assemblies Documentation
Insert Method (DocumentCollection)
Example 
ZennoLab.CommandCenter Namespace > DocumentCollection Class : Insert Method

Type: document

The document to insert.

Type: System.Int32

The zero-based index at which document should be inserted.

Inserts a document into the DocumentCollection at the specified index.
Syntax
public void Insert( 
   Document document,
   int index
)

Parameters

document

Type: document

The document to insert.

index

Type: System.Int32

The zero-based index at which document should be inserted.

Exceptions
ExceptionDescription
index is less than 0 or index is greater than Count.
Remarks
If index is equal to Count, item is added to the end of DocumentCollection.
Example
The following code example demonstrates the Insert method, along with various other properties and methods of the DocumentCollection.
// get all documents
DocumentCollection docCol = tab.AllDocuments;
 
// get main document
Document doc = tab.MainDocument;
 
if (docCol.Count <= 0) return -1
 
int index = docCol.Count / 2;
 
// insert main document to collection
docCol.Insert(doc, index);
// get all documents
$docCol = $tab->AllDocuments;
 
// get main document
$doc = $tab->MainDocument;
 
if ($docCol->Count <= 0) return -1
 
$index = $docCol=>Count / 2;
 
// insert main document to collection
$docCol->Insert($doc, $index);
Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

DocumentCollection Class
DocumentCollection Members
Add Method
AddRange Method
InsertRange Method
Count Property