[]
        
(Showing Draft Content)

JsonDataSource

Class JsonDataSource

java.lang.Object
com.grapecity.documents.excel.template.DataSource.JsonDataSource

public class JsonDataSource extends Object
The json datasource for the template.

 String jsonText = "[{\"student\":{\"name\":\"Jane\",\"score\":100}}]";
 JsonDataSource dataSource = new JsonDataSource(jsonText);
 workbook.addDataSource("ds", dataSource);
 
  • Constructor Details

    • JsonDataSource

      public JsonDataSource(String jsonText)
      Constructs a JSON data source from the specified JSON text.

      Use this constructor to wrap JSON content in a JsonDataSource so it can be added as a template data source or bound to a worksheet.

      
       String jsonText = "[{\"student\":{\"name\":\"Jane\",\"score\":100}}]";
       JsonDataSource dataSource = new JsonDataSource(jsonText);
       workbook.addDataSource("ds", dataSource);
       
      Parameters:
      jsonText - The JSON text.