Merge and Divide Documents
This examples show how you can merge and divide documents.
Merge Documents
In order to merge documents specify the documents and the file cabinet or basket where the documents reside. The merge operation creates a new document and removed the merged documents.
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocuWare.Platform.ServerClient;
namespace DocuWare.PlatformClientExamples
{
static partial class Examples
{
public static Document MergeDocumentsBasket(FileCabinet basket, List<int> docIds)
{
Document mergedDocument = basket.PutToContentMergeOperationRelationForDocument
(
new ContentMergeOperationInfo()
{
Documents = docIds,
Operation = ContentMergeOperation.Staple,
Force = true
}
);
return mergedDocument;
}
public static Document MergeDocumentsFileCabinet(FileCabinet cabinet, List<int> docIds)
{
Document mergedDocument = cabinet.PutToContentMergeOperationRelationForDocument
(
new ContentMergeOperationInfo()
{
Documents = docIds,
Operation = ContentMergeOperation.Clip,
Force = true
}
);
return mergedDocument;
}
}
}
Divide a Document
When a document id divided then new documents are created in the specified basket or file cabinet. The list of new documents is the result of the divide operation.
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocuWare.Platform.ServerClient;
namespace DocuWare.PlatformClientExamples
{
static partial class Examples
{
public static DocumentsQueryResult DivideDocument(Document doc)
{
doc = doc.GetDocumentFromSelfRelation();
DocumentsQueryResult result =
doc.PutToContentDivideOperationRelationForDocumentsQueryResult
(
new ContentDivideOperationInfo()
{
Force = true,
Operation = ContentDivideOperation.Unstaple
}
);
return result;
}
}
}