Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 71d49a2
Showing
6 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Copyright 2018 Ivan Ponomarev | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
An example of usage of [Xylophone](https://github.com/CourseOrchestra/xylophone) library. | ||
|
||
The command to run in CLI mode: | ||
|
||
xylophone -data testdata.xml -template template.xlsx -descr descriptor.xml -out report.xlsx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<element name="report"> | ||
<!-- Создаём лист --> | ||
<output worksheet="Отчет" sourcesheet="Лист1"/> | ||
<!-- И за ним слева направо заголовки столбцов --> | ||
<iteration mode="horizontal"> | ||
<element name="(before)"> | ||
<!-- Выводим пустую ячейку в ЛВУ сводной таблицы --> | ||
<output range="A1"/> | ||
</element> | ||
<element name="column"> | ||
<output range="B1"/> | ||
</element> | ||
</iteration> | ||
<!-- Выводим строки: итерация с режимом вывода умолчанию, сверху вниз --> | ||
<iteration mode="vertical"> | ||
<element name="item"> | ||
<!-- И по строке - слева направо --> | ||
<iteration mode="horizontal"> | ||
<element name="(before)"> | ||
<!-- Заголовок строки --> | ||
<output range="A2"/> | ||
</element> | ||
<!-- И за ним слева направо строку с данными --> | ||
<element name="year"> | ||
<output range="B2"/> | ||
</element> | ||
</iteration> | ||
</element> | ||
</iteration> | ||
<iteration> | ||
<element name="totals"> | ||
<iteration mode="horizontal"> | ||
<element name="(before)"> | ||
<!-- Заголовок строки --> | ||
<output range="A3"/> | ||
</element> | ||
<!-- И за ним слева направо строку с данными --> | ||
<element name="year"> | ||
<output range="B3"/> | ||
</element> | ||
</iteration> | ||
</element> | ||
</iteration> | ||
</element> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@Grab('ru.curs:xylophone:6.1.3') | ||
import ru.curs.xylophone.XML2Spreadsheet | ||
|
||
baseDir = '.' | ||
new File(baseDir, 'testdata.xml').withInputStream { | ||
input -> | ||
new File(baseDir, 'report.xlsx').withOutputStream { | ||
output -> | ||
XML2Spreadsheet.process(input, | ||
new File(baseDir, 'descriptor.xml'), | ||
new File(baseDir, 'template.xlsx'), | ||
false, output) | ||
} | ||
} | ||
println 'Done.' |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<report> | ||
<column year="2016"/> | ||
<column year="2017"/> | ||
<column year="2018"/> | ||
<item name="Товар 1"> | ||
<year amount="365"/> | ||
<year amount="286"/> | ||
<year amount="207"/> | ||
</item> | ||
<item name="Товар 2"> | ||
<year amount="95"/> | ||
<year amount="606"/> | ||
<year amount="840"/> | ||
</item> | ||
<item name="Товар 3"> | ||
<year amount="710"/> | ||
<year amount="437"/> | ||
<year amount="100"/> | ||
</item> | ||
<totals> | ||
<year amount="1170"/> | ||
<year amount="1329"/> | ||
<year amount="1147"/> | ||
</totals> | ||
</report> |