close messageThis website uses 'cookies', both our own as well as from third parties, to provide a better experience and service. When browsing our website or using our services you agree to our use of 'cookies'. For more information, see our Privacy policy.

cloneBlock

cloneBlock

ADVANCED / PREMIUM BASIC

Clones a block in the document.

Description
public void cloneBlock(String blockName)
public void cloneBlock(String blockName, Integer occurrence)
Parameters

blockName

The block var.

occurrence

Position of the block to be cloned. 1 as default.

Code samples

Example #1

x
 
1
package examples.DOCXPath.cloneBlock;
2
3
import com.javadocx.CreateDocxFromTemplate;
4
5
public class Sample1 {
6
    public static void main(String[] args) throws Exception {
7
        CreateDocxFromTemplate docx = new CreateDocxFromTemplate("src/examples/files/TemplateBlocks_2.docx");
8
        
9
        docx.cloneBlock("FIRST");
10
        
11
        docx.clearBlocks();
12
        
13
        docx.createDocx("example_cloneBlock_1");
14
    }
15
}
16
­
­