Search Results for

    Show / Hide Table of Contents

    Uploading a new template

    One of the main features of FastReport Cloud is storing templates, reports, and other data in the cloud. This article will cover how to upload your prepared template into the FastReport Cloud template repository.

    Getting Started

    You will need the following tools and features:

    1. Knowledge of using API key in FastReport Сloud.

      This article will skip additional information on authentication and authorization.

    2. .NET SDK.

    3. A C# code editor or a text editor such as Visual Studio Code.

    4. Report template.

      It can be created using the free program FastReport Community Designer.

    5. Active FastReport Сloud subscription.

    6. Access to the Internet.

    Note! This guide assumes that you already know how to develop your application in the C# programming language.

    Note! The paragraphs above describe the recommended tools.

    Instruction

    1. You need to get the identifier of the workspace root folder. This identifier will never change, so you can save it and not have to request it every time before uploading a new template.

    2. To request the root directory, call the method GetRootFolderAsync(String, System.Threading.CancellationToken).

      public async Task<string> GetTemplatesRoot(HttpClient httpClient, string subscriptionId = null)
      {
          ITemplateFoldersClient templateFoldersClient = new TemplateFoldersClient(httpClient);
      
          FileVM result = await templateFoldersClient.GetRootFolderAsync(subscriptionId);
      
          return result.Id;
      }
      

      In this example, the subscriptionId parameter specifies the identifier of the workspace (subscription). If it is not specified (equals null), the identifier of the user's default workspace will be returned.

    3. To upload the required template, use the method UploadFileAsync(String, TemplateCreateVM, System.Threading.CancellationToken).

      public async Task<string> UploadFrx(HttpClient httpClient, string folderId, string filePath)
      {
          ITemplatesClient templatesClient = new TemplatesClient(httpClient);
      
          byte[] bytes = File.ReadAllBytes(filePath);
      
          TemplateCreateVM model = new TemplateCreateVM()
          {
              Name = Path.GetFileName(filePath),
              Content = Convert.ToBase64String(bytes)
          };
      
          TemplateVM result = await templatesClient.UploadFileAsync(folderId, model);
      
          return result.Id;
      }
      

      In this example, the function receives a file from the disk and uploads it to the folderId directory. More about the parameters:

      • folderId — template directory identifier.

      • model.Name — file name, as it will be displayed inside FastReport Cloud.

        The file name must have the .frx extension, if not, then add it manually.

      • model.Content — file content encoded in base64.

      The method returns the identifier of the uploaded template.

      Now this template can be used to prepare (build) a report and export.

    What's next?

    • Permission management on the example of a template.
    • Building a report.
    Back to top 2025.2.5 © 1998-2025 Copyright Fast Reports Inc.