README.md 1.35 KB
Newer Older
Matija Obreza's avatar
Matija Obreza committed
1
2
3
4
5
6
7
8
9
10
11
# Excel Template Merge with JSON #

This is a simple tool has two components: a bit that converts Excel
spreadsheet data into JSON and the other bit that takes an Excel
spreadsheet and fills it with data from JSON.

Putting both together allows you to create many Excel files, each using
the same Excel file as template, but filling each one with data from a
list of JSON objects. This would be similar to the Merge function in
Word, but the template is an Excel spreadsheet.

Matija Obreza's avatar
Matija Obreza committed
12
13
## Concepts ##

Matija Obreza's avatar
Matija Obreza committed
14
15
Check out the [Concepts](docs/Concepts.html) in the 
[Documentation folder](docs/)
Matija Obreza's avatar
Matija Obreza committed
16

Matija Obreza's avatar
Matija Obreza committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## Using the library ##

Add to your `pom.xml`

	<dependency>
		<groupId>org.croptrust</groupId>
		<artifactId>excel-json</artifactId>
		<version>0.2-SNAPSHOT</version>
	</dependency>

You will need to configure JsonPath defaults somewhere in your code to set
the providers as described at https://github.com/jayway/JsonPath

	Configuration.setDefaults(new Configuration.Defaults() {
		private final JsonProvider jsonProvider = new JacksonJsonProvider();
		private final MappingProvider mappingProvider = new JacksonMappingProvider();

		@Override
		public JsonProvider jsonProvider() {
			return jsonProvider;
		}

		@Override
		public MappingProvider mappingProvider() {
			return mappingProvider;
		}

		@Override
		public Set<Option> options() {
			return EnumSet.noneOf(Option.class);
		}
	});