How to Run the Examples

To become more familiar with the Aspose.Words possibilities and features we provide examples that can be downloaded from our GitHub repository, run, and learn in detail.

In this article, you can find the system requirements, as well as information on how to run the examples.

Windows with Nuget Package

Software Requirements and Prerequisites

Please make sure you meet the following requirements before downloading and running the examples:

  1. Visual Studio Code, Visual Studio 2017, or Visual Studio 2019.
  2. Installed NuGet Package Manager and the latest NuGet API version for Visual Studio. (optional)
  3. Selected nuget.org option in the “Tools → Options" dialog box under “NuGet Package Manager → Package Sources”.
  4. An active Internet connection to use the NuGet Automatic Package Restore feature in the Examples project. If you do not have an active Internet connection on the machine where the examples are to be executed follow the directions from Windows with Cmake Package.

Download and Run the Examples

All Aspose.Words for C++ examples are hosted on GitHub. You can either clone the repository using your favorite GitHub client or download the ZIP file.

After getting a copy of the repository, you may find that:

  • All the examples are located in the Examples folder.
  • There are Visual Studio solution files for C++ created in Visual Studio 2017.

To run the examples, open the solution file in Visual Studio and build the project:

  • For API Reference examples, the structure is based on class names, for Docs examples it is mostly based on the Developer Guiled documentation section.
  • On the first run, the dependencies will be automatically downloaded via NuGet.
  • The Data folder at the root folder of Examples contains input files that were used in the examples.
  • All examples can be run as unit tests.

Windows with CMake Package

Software Requirements and Prerequisites

Please make sure you meet the following requirements before downloading and running the examples:

  1. Visual Studio Code, Visual Studio 2017, or Visual Studio 2019.
  2. Cmake >= 3.16.0
  3. Download lastest CMake Package from https://downloads.aspose.com/words/cpp

Download and Run the Examples

All Aspose.Words for C++ examples are hosted on GitHub. You can either clone the repository using your favorite GitHub client or download the ZIP file.

Place folders Aspose.Words.Cpp and CodePorting.Native.Cs2Cpp_* in the root of a copy of the repository.

All the examples are located in the Examples folder.

To run the examples run the following commands from the root of a copy of the repository:

cmake -G "Visual Studio 16 2019" -Thost=x64 -Ax64 -S Examples\DocsExamples\ -B Examples\DocsExamples\build

The solution for Visual Studio will be generated in the Examples\DocsExamples\build

To run the examples, open the solution file in Visual Studio and build the project:

  • For API Reference examples, the structure is based on class names, for Docs examples it is mostly based on the Developer Guiled documentation section.
  • The Data folder at the root folder of Examples contains input files that were used in the examples.
  • All examples can be run as unit tests.

Linux

Software Requirements and Prerequisites

Please make sure you meet the following requirements before downloading and running the examples:

  1. GCC >= 6.3 or CLang >= 3.9.1
  2. GNU Make or Ninja
  3. Cmake >= 3.16.0
  4. Download lastest CMake Package from https://downloads.aspose.com/words/cpp

Download and Run the Examples

All Aspose.Words for C++ examples are hosted on GitHub. You can either clone the repository using your favorite GitHub client or download the ZIP file.

Place folders Aspose.Words.Cpp and CodePorting.Native.Cs2Cpp_* in the root of a copy of the repository.

All the examples are located in the Examples folder.

To run the examples run the following commands from the root of a copy of the repository:

cmake -S Examples/DocsExamples -B Examples/DocsExamples/build -D CMAKE_BUILD_TYPE=Release
cmake --build Examples/DocsExamples/build

cmake -E chdir Examples/DocsExamples/build ctest --verbose

  • For API Reference examples, the structure is based on class names, for Docs examples it is mostly based on the Developer Guiled documentation section.
  • The Data folder at the root folder of Examples contains input files that were used in the examples.
  • All examples can be run as unit tests.

Contribute to Improving the Examples

If you like to add or improve an example, we encourage you to contribute to the project. All examples and showcase projects in this repository are open source and can be freely used in your applications.

You can fork the repository, edit the source code, and create a pull request to contribute. We will review the changes and include them in the repository if found helpful.

See Also