# camunda-dmn-xlsx
**Repository Path**: jiangyang01/camunda-dmn-xlsx
## Basic Information
- **Project Name**: camunda-dmn-xlsx
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Apache-2.0
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 1
- **Created**: 2022-04-23
- **Last Updated**: 2022-04-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](https://github.com/camunda-community-hub/community)
[](https://github.com/Camunda-Community-Hub/community/blob/main/extension-lifecycle.md#abandoned-)
[](https://github.com/Camunda-Community-Hub/community/blob/main/extension-lifecycle.md#abandoned-)
Excel table to DMN decision table converter
===========================================
This project has two components:
1. A standalone converter to transform Excel worksheets (xlsx files) into DMN decision tables (dmn files), implemented and embeddable in Java.
2. A [Camunda BPM](https://www.camunda.org) process engine plugin to enable xlsx deployment as part of process applications. Xlsx files are then converted on the fly to DMN tables.
## Examples
### Simple Mode
See also: [Camunda Team Blog: Converting Excel Worksheets to DMN](https://blog.camunda.com/post/2016/01/excel-dmn-conversion/)
#### Input: Spreadsheet

#### Output: DMN Decision Table

### Advanced Mode
See also: [Added support for a new "advanced" detection strategy #8](https://github.com/camunda/camunda-dmn-xlsx/pull/23)
[Example spreadsheet file](https://github.com/camunda/camunda-dmn-xlsx/blob/master/xlsx-dmn-converter/src/test/resources/test6.xlsx)

Features
--------
* Conversion of Excel worksheets to DMN decision tables with inputs, outputs and rules
* Pluggable strategy to determine columns that represent inputs and outputs
* Comes as a Java library that can be embedded into custom applications
* Comes as a command line application to execute standalone
* Comes as a process engine plugin to integrate with process application deployments
Usage
-----
### Standalone Converter
#### Command Line
1. [Download the command line tool](https://artifacts.camunda.com/artifactory/public/org/camunda/bpm/extension/dmn/dmn-xlsx-cli/0.2.0/dmn-xlsx-cli-0.2.0.jar). It is a runnable jar file, so you need to have Java installed.
2. Take an Excel file that contains a decision to convert and place it next to the downloaded jar.
3. Execute `java -jar dmn-xlsx-cli-0.2.0.jar --inputs A,B,C --outputs D,E,F path/to/input/file.xlsx path/to/output/file.dmn`. Note that this example assumes the columns A, B, and C are inputs and D, E, F are outputs. You can set these as you like.
4. Obtain the dmn table and import it in Camunda modeler or in the [online DMN table editor](http://demo.bpmn.io/dmn).
#### Java
##### Artifacts
To use the Java library, add the following Maven dependency to your project:
```xml
org.camunda.bpm.extension.dmn
dmn-xlsx-converter
0.2.0
```
##### Read Excel file, transform to DMN, write to DMN file:
```java
InputStream xlsxInputStream = ...; // open xlsx file here
// convert
XlsxConverter converter = new XlsxConverter();
DmnModelInstance dmnModelInstance = converter.convert(inputStream);
// write
OutputStream dmnOutputStream = ...; // open outputstream to file here
Dmn.writeModelToStream(dmnOutputStream, dmnModelInstance);
```
##### Configure conversion
The class `org.camunda.bpm.dmn.xlsx.XlsxConverter` has bean properties that allow configuration of the conversion process. These are:
* `ioDetectionStrategy`: An instance of `org.camunda.bpm.dmn.xlsx.InputOutputDetectionStrategy`. The default strategy assumes that all but the last column of the worksheet are inputs and the last column is an output. An instance of `org.camunda.bpm.dmn.xlsx.StaticInputOutputDetectionStrategy` can be set to define a static set of input and output columns. Custom strategies can be implemented by implementing the interface `InputOutputDetectionStrategy`.
### Camunda BPM process engine plugin
#### Artifacts
The process engine artifact can be obtained via the following Maven coordinates:
```xml
org.camunda.bpm.extension.dmn
dmn-xlsx-process-engine-plugin
0.2.0
```
#### Configuration
Make sure to make the resulting `org.camunda.bpm.dmn:dmn-xlsx-process-engine-plugin` artifact available on the process engine's classpath. Then configure the class `org.camunda.bpm.xlsx.plugin.XlsxDmnProcessEnginePlugin` as a process engine plugin.
#### Usage
With the plugin in place, xlsx files can be included in a deployment and are automatically recognized and converted into DMN XML at deployment time. To configure conversion for a file `.xlsx`, a file `.xlsx.yaml` can be included in the deployment. Example yaml contents:
```yaml
---
inputs: ['A', 'B']
outputs: ['C', 'E']
```
This declares that the columns A and B are inputs of the decision and C and E are outputs.
License
-------
Apache License 2.0.
How to contribute
-----------------
Contributions are welcome at any time. Use github issues to discuss missing features or report bugs, and pull requests to contribute code.