[]
        
(Showing Draft Content)

Quick Start: Configure DsDataViewer

The steps below describe how to create a simple ASP.NET Core web application that uses DsDataViewer to view data files.

  1. Open Microsoft Visual Studio and select Create a new project | ASP.NET Core Web App and name it. In this example, we have named it as “DsDataViewerApp”.

    Visual Studio selects the ASP.NET Core Web App template for creating the DsDataViewerApp project that will host DsDataViewer.

  2. Open the project in File Explorer and locate the wwwroot > lib directory.

  3. Right-click on lib folder and select Open in Terminal. Run the following command to install DsDataViewer

    npm install @mescius/dsdataviewer

  4. Observe that DsDataViewer gets installed at following location:

    DsDataViewerApp\wwwroot\lib\node_modules\@mescius\dsdataviewer

  5. In Solution Explorer, right click wwwroot folder of the project and select Add > New Item to add a new HTML file named 'index.html'.

  6. To initialize DsDataViewer, add the following code to index.html.

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="utf-8">
        <meta name="description" content="Document Solutions Data Viewer">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes" />
        <script type="text/javascript" src="lib/node_modules/@mescius/dsdataviewer/dsdataviewer.js"></script>
    
        <title>Document Solutions Data Viewer</title>
        <script>
            function loadDataViewer(selector) {
                //DsDataViewer.LicenseKey = 'your_license_key';
                var viewer = new DsDataViewer(selector, {});
            }</script>
        <link rel="stylesheet" type="text/css" href="css/style.css">
    </head>
    
    <body onload="loadDataViewer('#root')">
        <div id="root" class="dsdataviewer"></div>
    </body>
    
    
    </html>
  7. In Visual Studio, add a new stylesheet 'style.css' in wwwroot/css folder of the project and add following code.

    Visual Studio selects the Style Sheet template for adding style.css and defining the DsDataViewer container height.

    .dsdataviewer {
        height: 100%;
    }
  8. To start the application with index.html by default, in Program.cs file, replace the default methods with following code.

    var builder = WebApplication.CreateBuilder(args);
    
    // Add services to the container.
    builder.Services.AddRazorPages();
    
    var app = builder.Build();
    
    // Configure the HTTP request pipeline.
    if (!app.Environment.IsDevelopment())
    {
        app.UseExceptionHandler("/Error");
    }
    
    app.UseHttpsRedirection();
    app.UseDefaultFiles();
    app.UseStaticFiles();
    app.UseRouting();
    app.UseAuthorization();
    app.MapRazorPages();
    app.Run();
  9. Build and run the application. A page displaying DsDataViewer opens in your default browser.

    DsDataViewer opens in the browser with its toolbar visible above an empty data display area after the application starts.

  10. User can use Open document button(The DsDataViewer Open document toolbar button lets users select a supported local or remote data file.) on the top-left of the DsDataViewer control to open a file.

    DsDataViewer displays the loaded monthly budget workbook with formatted summary, income, and expenditure data on worksheet tabs.

For more information, see Load a File.