No of characters in String

Suppose I am passing a dummy data as follows
{"key1":"value1"}

In my word document I want to print the size of the string corresponding to key1 in my word document
what is the syntax for that?

@patilnishant0311 You can use the following syntax:

<<[key1.length()]>>

For example see the following cede:

String json = "{\"key1\":\"value1\"}";
JsonDataSource ds = new JsonDataSource(new ByteArrayInputStream(json.getBytes()));
        
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("<<[key1.length()]>>");
builder.writeln("<<[key1]>>");
    
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, ds);
    
doc.save("C:\\Temp\\out.docx");
1 Like