From 8475f64388d3a0b5062c19c78372ff9ca28a52cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Wed, 9 Aug 2023 18:20:15 +0200 Subject: [PATCH] change value to text in cell element --- gradle.properties | 2 +- .../scripting/command/CellCommand.java | 4 +-- .../pdfbox/layout/test/scripting.json | 26 +++++++++---------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/gradle.properties b/gradle.properties index 035debe..09cd9c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group = org.xbib.graphics name = graphics -version = 4.5.0 +version = 4.5.1 org.gradle.warning.mode = ALL diff --git a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/CellCommand.java b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/CellCommand.java index c1941c3..c7ba0e8 100644 --- a/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/CellCommand.java +++ b/graphics-pdfbox-layout/src/main/java/org/xbib/graphics/pdfbox/layout/element/scripting/command/CellCommand.java @@ -27,7 +27,7 @@ public class CellCommand implements Command { @Override public void execute(Engine engine, State state, Settings settings) throws IOException { - if (settings.containsSetting("value")) { + if (settings.containsSetting("text")) { TextCell.Builder cell = TextCell.builder(); if (settings.containsSetting("padding")) { String padding = settings.get("padding", "0 0 0 0"); @@ -38,7 +38,7 @@ public class CellCommand implements Command { float paddingBottom = Float.parseFloat(paddings[3]); cell.padding(paddingLeft, paddingRight, paddingTop, paddingBottom); } - cell.text(settings.get("value")); + cell.text(settings.get("text")); cell.fontSize(settings.getAsFloat("fontsize", 11.0f)); Document document = state.getDocument(); Font font = document.getFont(settings.get("font", "helvetica").toUpperCase(Locale.ROOT)); diff --git a/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json b/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json index df084c8..9662b21 100644 --- a/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json +++ b/graphics-pdfbox-layout/src/test/resources/org/xbib/graphics/pdfbox/layout/test/scripting.json @@ -128,15 +128,15 @@ "elements": [ { "type": "cell", - "value": "Cell A" + "text": "Cell A" }, { "type": "cell", - "value": "Cell B" + "text": "Cell B" }, { "type": "cell", - "value": "Cell C" + "text": "Cell C" } ] }, @@ -145,15 +145,15 @@ "elements": [ { "type": "cell", - "value": "Cell D" + "text": "Cell D" }, { "type": "cell", - "value": "Cell E" + "text": "Cell E" }, { "type": "cell", - "value": "Cell F" + "text": "Cell F" } ] } @@ -168,15 +168,15 @@ "elements": [ { "type": "cell", - "value": "Cell 1" + "text": "Cell 1" }, { "type": "cell", - "value": "Cell 2" + "text": "Cell 2" }, { "type": "cell", - "value": "Cell 3" + "text": "Cell 3" } ] }, @@ -185,19 +185,19 @@ "elements": [ { "type": "cell", - "value": "Cell 4", + "text": "Cell 4", "padding": "5 5 5 5", "borderwidth": 0.5 }, { "type": "cell", - "value": "Cell 5", + "text": "Cell 5", "padding": "5 5 5 5", "borderwidth": 0.5 }, { "type": "cell", - "value": "Cell 6", + "text": "Cell 6", "padding": "5 5 5 5", "borderwidth": 0.5 } @@ -210,7 +210,7 @@ "elements": [ { "type": "text", - "value": "Hello World 6", + "text": "Hello World 6", "fontsize": 20, "font": "notosans" }