To create this, we added the “generate” function. Here we create the “key” variable and set it to blank. Later, it will store the generated value. In addition, we added the “data” variable, which will contain upper and lower case letters and numbers. of our unique ID:
We then add a “for loop
That will the building execute 12 iterations. Each iteration will return a unique value. Therefore, 12 iterations will produce 12 unique characters for the ID. We then use the “Math.random” method to get a unique index in each iteration. After that, we use this index and the “charAt” method to retrieve a unique character from the “data” variable. We assign the result to the “key” variable and return it for subsequent use. We then call the “generate” function and assign it to the “id” variable:
Assign a unique ID to an OFORM form
Using the building ONLYOFFICE products, we can easily create and manipulate fillable forms. In the previous blog post, we showed you a macro that converts CSV/TXT data into a fillable combo box.
Today, we’re going to build a macro that assigns unique IDs to fillable forms, making electronic documents more organized.
Assign a the building lista de números de telegrama unique id to OFORMS
Preliminary preparation
In this new project, we will implement a similar concept to the macros mentioned above.
The macro code is as follows
Through a the building new macro, we will also incorporate the “InsertContent” method. It will insert an element at the cursor position. This time, the inserted content is different.
Now we need to insert the generated content into the document. First, we target the active form:
After that, we the building create a paragraph and add a text element inside it. We wrap the generated content in this element by passing the “id” variable in the parameters:
We then insert it. The “InsertContent
Method the building para obter detalhes, participe de nossa transmissão ao vivo no youtube embeds an element at the cursor position. We also specify the “KeepTextOnly” property. We set it to “true” to prevent positioning diretório adb issues:
We hope you will find this macro useful and add it to your workflow. ONLYOFFICE macros are very versatile and allow users to work with files in a variety of ways. This macro is just one of many examples of what you can achieve by implementing our API methods.