.Net samples guide
Before you start
For the samples to work correctly, make sure that two conditions are met:
- ONLYOFFICE Document Builder is installed into default directory "C:/Program Files/ONLYOFFICE/DocumentBuilder" on your computer.
- The directory in which you are going to store the downloaded samples has general editing access to save files created by the Document Builder.
Download a sample
Download one of the Builder .Net samples and copy it into a folder with general editing access.
- Filling spreadsheet
- Commenting spreadsheet errors
- Creating presentation
- Creating chart presentation
- Creating basic form
- Creating advanced form
- Filling form
Sample structure
Each sample includes a code folder, an sln file, and a template file if the sample uses a template.
The code folder consists of two files: a project file and a program file.
Please note that the path to the DocBuilder .dll file in the project file is set to default. Here you can change the path if DocBuilder is located in a different directory on your computer.
Program structure
- Include doctrenderer library .Net wrapper classes.
- Specify the paths to the Document Builder work directory, the result path (where the generated file will be saved), and the optional file path (if a template file will be used).
- Add .dll files to the environment.
- Call the builder function (this function is created by user and calls the DocBuilder method to work with documents).
- Initialize the DocBuilder from the working directory. After that Builder opens or creates a file so that Context, Scope and Global classes can be accessed.
- Edit file using DocBuilder API methods. Use Call method with the name and params of the API method you call as an arguments.
- Save and close file after editing, then call the Destroy method to destroy DocBuilder.
Run the sample
Open .sln file inside the sample folder to build the project.
Run the program when the project is built.
Check the result
After program execution the result file will be saved to the result path. It's sample folder root by default.
Open result file and check the result.