ONLYOFFICE Document Builder 7.2
Tags: onlyoffice, api, news, update
Published: 2022-10-06 14:13:32

We fully upgraded the native [ONLYOFFICE Doc Builder API](https://api.onlyoffice.com/docbuilder/basic) to make document generation more comfortable using JS commands instead of text ones.

The [integration API](https://api.onlyoffice.com/docbuilder/integrationapi) includes new classes and methods which make it easier to work with С/С++ data types.

Moreover, we added the [.Net doctrenderer](https://api.onlyoffice.com/docbuilder/integrationapi/net?utm_source=blog&utm_medium=article&utm_campaign=builder_72) library which allows working with the Doc Builder API in your .Net-based app. We are also going to add the Java wrapper option a bit later.

## JSON conversion

With the new `FromJSON` and `ToJSON` methods, you can convert the specified JSON object into the Document Builder object of the corresponding type and vice versa — convert the ApiDocument object into the JSON object. This applies to such elements as hyperlinks, paragraphs, numberings, tables, slides, etc.

```
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
.....
var sJSON = oDocument.ToJSON(false, false, true, true);
....
builder.SaveFile("docx", "ToJSON.docx");
builder.CloseFile();
```

## OLE methods

We added the `ApiOleObject` class to the Doc Builder API. For example, with the `CreateOleObject` method, you can create an OLE object with the specified parameters. In the practical way, this allows adding and editing spreadsheets as OLE objects embedded in text docs, sheets, and slides what can be useful when working with smart statistics and reports.

```
builder.CreateFile("xlsx"); 
var oWorksheet = Api.GetActiveSheet(); 
oWorksheet.AddOleObject("https://i.ytimg.com/vi_webp/SKGz4pmnpgY/sddefault.webp", 130 * 36000, 90 * 36000, "https://youtu.be/SKGz4pmnpgY", "asc.{38E022EA-AD92-45FC-B22B-49DF39746DB4}", 0, 2 * 36000, 4, 3 * 36000); 
builder.SaveFile("xlsx", "AddOleObject.xlsx"); 
builder.CloseFile();
```

## New form methods

Thanks to the new form methods, it’s now possible to retrieve a list of all tags which are used for Content Controls and forms in the document, as well as get back a list of all Content Controls and forms with the specified tag name.

It simplifies work with fields in the automatic mode, for example, when parsing a document without opening it.

## Endnotes, footnotes, Word Art

Build documents with endnotes and footnotes:

```
builder.CreateFile("docx"); 
var oDocument = Api.GetDocument();  
var oParagraph = oDocument.GetElement(0);  
oParagraph.AddText("This is just a sample text."); 
oDocument.AddEndnote();
builder.SaveFile("docx", "AddEndnote.docx");
builder.CloseFile();
```
Besides, now you can create Word Art objects when generating text documents, spreadsheets, and presentations.

## More chart and drawing methods

New chart methods include:

- `ApplyChartStyle` to set a style to the current chart by style ID;
- `SetLegendFill` to set a filling to the chart legend;
- `SetSeriaValues` to set values from the specified range to the specified series;
- `SetTitleFill` to set the fill to the chart title;
- and more.

Among updated drawing methods you will find:

- `ReplaceDrawing` to replace a drawing with a new one;
- `GetLockValue` to get back the lock value for the specified lock type of the current drawing;
- `SetDrawingPrFromDrawing` to set the properties from another drawing to the current one;
- and several others.

## Other updates

With the `UpdateAllTOC` and `UpdateAllTOF` methods, you are able to update all Tables of Contents and all Tables of Figures in the current document.

New table methods for text docs allow setting/getting the table description and table title/caption.

## Useful links

[Get ONLYOFFICE Document Builder](https://www.onlyoffice.com/download-builder.aspx)

[Document Builder API changelog](https://api.onlyoffice.com/docbuilder/changelog)

[ONLYOFFICE Docs Developer Edition v7.2](https://dev.to/onlyoffice/onlyoffice-docs-developer-edition-version-72-released-1hmo)