Views:

Question:
How is it possible to export a document in the *.dwx format that was introduced with DocuWare 6.9.

Answer:
Example 1: Export a single document
Prerequisite is the already given object "actualDoc" of the type "Document", e.g. from a previous search.

actualDoc = actualDoc.GetDocumentFromSelfRelation();
using (Stream stream = actualDoc.PostToDownloadAsArchiveRelationForStream(new ExportSettings()))
{
    string fileName = @"C:\temp\SingleDoc.dwx";

    using (FileStream output = File.Create(fileName))
    {
        stream.CopyTo(output);
    }
}
Example 2: Export multiple documents based on a search query
Prerequisite is an object "queryResult" of the type "DocumentsQueryResult".
string fileName = @"C:\temp\QueryResult.dwx";
using (Stream str = queryResult.PostToExportDocumentsRelationForStream(new ExportSettings()))
{
    using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
    {
        str.CopyTo(fs);
    }
}