[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Collapse]Office File API
  Demo Application
  Redistribution and Deployment
 [Expand]Spreadsheet Document API
 [Expand]Word Processing Document API
 [Expand]PDF Document API
 [Expand]Excel Export Library
 [Collapse]Snap Report API
   Getting Started
 [Expand]Zip Compression and Archive API
 [Expand]Barcode Generation API
 [Expand]Unit Conversion API
 [Expand]API Reference
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

Getting Started

The following article describes how to get started with the SnapDocumentServer and create a simple report from scratch.

This tutorial consists of the following sections.

Expanded Create an Application

  1. Start Visual Studio and create a new project by selecting FILE | New | Project… in the main menu. In the invoked New Project dialog, select a Console Application, specify the project name and location, and click OK.

  2. In the Solution Explorer, right-click the References node and select Add Reference... in the context menu.

  3. In the invoked Reference Manager dialog, add references to the following libraries.

    • DevExpress.Data.v19.1.dll
    • DevExpress.Docs.v19.1.dll
    • DevExpress.Office.v19.1.Core.dll
    • DevExpress.RichEdit.v19.1.Core.dll
    • DevExpress.Snap.v19.1.Core.dll
  4. Paste the following code in the Main method of the Program.cs file (Main procedure of the Module1.vb file for Visual Basic). The code snippet creates a new SnapDocumentServer instance, associates it with the data source, generates the tabular report and opens it in the default application registered for this file type.

Expanded Connect to Data

  • Open the PROJECT menu and click the Add New Data Source... command.

  • In the invoked Data Source Configuration Wizard, select Database and click Next.

  • Select Dataset to specify the type of a database model and click Next.

  • On the next page, click New Connection... to specify which data connection should be used.

  • In the invoked Add Connection dialog, set your data source to Microsoft SQL Server Database Fie(SqlClient) and specify the database file path. This tutorial uses a connection to the sample Northwind database (the NWind.mdf file is included in the product installation).

    Click OK to apply the changes. In the Data Source Configuration Wizard, click Next.

  • Click Next on the following page to save the newly created connection string to the configuration file.

  • The final wizard page allows you to choose which tables to obtain from the database. After this step, click Finish.

  • Create a new DataSet object and populate it with data from the database by adding the following code.

Expanded Generate a Report Layout

  • Use the code below to generate a simple template and fill it with data. The code snippet created a snap list with three data entries and a header, and exports the result to the SnapDocumentServerTest.rtf file.


    This example demonstrates how to generate the template in code. You can also use a document template created in the DevExpress Snap at runtime. To learn how to generate a template using the Snap UI, check the Snap List and Document Template topic.

The following image shows the report generated after executing the code above (the document is opened in Microsoft® Word®).


This tutorial concentrates on a very limited set of actions that can be performed with Snap. For more information on the Snap reporting functionality, see the tutorials in the Examples section.

Expanded See Also

Is this topic helpful?​​​​​​​