Как вставить изображения в Birt на языке исполнения (Java) - PullRequest
0 голосов
/ 23 ноября 2018

Я могу создать отчет Birt в моем приложении Rcp, но проблема в том, что я не смог добавить изображения в данные таблицы (данные ячейки)

Путь или расположение изображения находится в моей рабочей области,Мой вопрос: как я могу указать путь или местоположение для изображения, которое будет отображаться в таблице отчетов.У нас есть метод SetURL для обработчика изображений, но он выдавал ошибку, как следует

TextItemHandle cellData = null;
CellHandle contenCell = null;
contentCell = (CellHandle) tabledetail.getCells().get(0);
cellData = designFactory.newTextItem(value);
cellData.setContent(value.replace(" ", ""));
cellData.setProperty("canShrink", "false");

cellData.getPropertyHandle(StyleHandle.FONT_SIZE_PROP).setIntValue(10);

image = designFactory.newImage("");
image.setURL("platform:/plugin/com.****.reportgeneration/images/Information-icon.gif");
contentCell.getContent().add(cellData);   
contentCell.getContent().add(image);

Полный стек исключений

org.eclipse.birt.report.engine.api.EngineException: Произошла ошибка при запуске отчета.в org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions (EngineTask.java:2375) в org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun (RunAndRenderT19)на org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.run (RunAndRenderTask.java:77) на com. ****. reportgeneration.popup.actions.ModuleReportGeneration.createReportFolder (ModuleReportGeneration.java:4)com. ****. reportgeneration.popup.actions.ModuleReportGeneration.access $ 0 (ModuleReportGeneration.java:402) на com. ****. reportgeneration.popup.actions.ModuleReportGeneration $ 1.run (ModuleReportGeneration.java:325) вorg.eclipse.jface.operation.ModalContext $ ModalContextThread.run (ModalContext.java:119) Вызывается: org.mozilla.javascript.EvaluatorException: недопустимый флаг после регулярного выражения (# 1) в org.mozilla.javascript.DefaultEruntimeEror(DefaultErrorReporter.java:77) в org.mozilla.javascript.DefaultErrorReporter.error (DefaultErrorReporter.java:64) в org.mozilla.javascript.Parser.addError (Parser.java:188) в org.mozilla.javascript.Parser.addError (Parser.java:166) в org.mozilla.javascript.Parser.reportError (Parser.java:223) в org.mozilla.javascript.Parser.reportError (Parser.java:210) в org.mozilla.javascript.Parser.reportError (Parser.java:203) в org.mozilla.javascript.TokenStream.readRegExp (TokenStream.java:921) в org.mozilla.javascript.Parser.primaryExpr (Parser.java:2798) в org.mozilla.javascript.Parser.memberExpr (Parser.java:2406) в org.mozilla.javascript.Parser.unaryExpr (Parser.java:2304) в org.mozilla.javascript.Parser.mulExpr (Parser.java:2229) в org.mozilla.javascript.Parser.addExpr (Parser.java:2213) в org.mozilla.javascript.Parser.shiftExpr (Parser.java:2194) в орг.mozilla.javascript.Parser.relExpr (Parser.java:2169) в org.mozilla.javascript.Parser.eqExpr (Parser.java:2141) в org.mozilla.javascript.Parser.bitAndExpr (Parser.java:2130) в org.mozilla.javascript.Parser.bitXorExpr (Parser.java:2119) в org.mozilla.javascript.Parser.bitOrExpr (Parser.java:2108) в org.mozilla.javascript.Parser.andExpr (Parser.java:2097) в org.mozilla.javascript.Parser.orExpr (Parser.java:2086) в org.mozilla.javascript.Parser.condExpr(Parser.java:2062) в org.mozilla.javascript.Parser.assignExpr (Parser.java:2033) в org.mozilla.javascript.Parser.expr (Parser.java:2012) в org.mozilla.javascript.Parser.StatementHelper (Parser.java:1039) в org.mozilla.javascript.Parser.nameOrLabel (Parser.java:1793) в org.mozilla.javascript.Parser.statementHelper (Parser.java:1032) в org.mozilla.javascript.Parser.statement (Parser.java:901) в org.mozilla.javascript.Parser.parse (Parser.java:540) в org.mozilla.javascript.Parser.parse (Parser.java:478) в org.mozilla.javascript.Context.compileImpl (Context.java:2348) в org.mozilla.javascript.Context.compileString (Context.java:1335) в org.mozilla.javascript.Context.compileString (Context.java:1324) в org.eclipse.birt.report.engine.javascript.JavascriptEngine $ 3.run (JavascriptEngine.java:240) в org.eclipse.birt.report.engine.javascript.JavascriptEngine $ 3.run (JavascriptEngine.java:1) в java.security.AccessController.doPrivileged (собственный метод)в org.eclipse.birt.report.engine.javascript.JavascriptEngine.compile (JavascriptEngine.java:236) в org.eclipse.birt.report.engine.javascript.JavascriptEngine.compile (JavascriptEngine.javag1: at).birt.core.script.ScriptContext.compile (ScriptContext.java:153) в org.eclipse.birt.report.engine.executor.ExecutionContext.compile (ExecutionContext.java:779) в org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate (ExecutionContext.java:713) по адресу org.eclipse.birt.report.engine.executor.ReportItemExecutor.evaluateString (ReportItemExecutor.java:297) по адресу org.eclipse.birt.report.IIngExecutor..handleURIImage (ImageItemExecutor.java:261) в org.eclipse.birt.report.engine.executor.ImageItemExecutor.handleImage (ImageItemExecutor.java:214) в org.eclipse.birt.report.engine.executor.ImageItemExecutor.Ix.java: 111) at org.eclipse.birt.report.engine.internal.executor.dup.SuppressDuplicateItemExecutor.execute (SuppressDuplicateItemExecutor.java:43..java: 34) по адресу org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes (HTMLBlockStackingLM.java:65) по адресу org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layt.htmlStackingLM..java: 26) в org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout (HTMLAbstractLM.java:140) в org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLay (HTMLS.java: 111) в org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes (HTMLInlineStackingLM.java:160) в org.eclipse.birt.report.engine.layout.html.HTMLStahL.java: 26) в org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout (HTMLAbstractLM.java:140) в org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes (HTMLBlockStackingLM.java:70) по адресу org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren (HTMLStackingLM.java:irt.p.gg или через.engine.layout.html.HTMLTableBandLM.layoutChildren (HTMLTableBandLM.java:67) в org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout (HTMLAbstractLM.java:140) в org.irt.reip.engine.layout.html.HTMLBlockStackingLM.layoutNodes (HTMLBlockStackingLM.java:70) в org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren (HTMLStackingLM.java:lre.bort.gt.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren (HTMLRepeatHeaderLM.java:46) в org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout (HTMLAbstractLM.java:1irt.se.b.b.g.engine.layout.html.HTMLBlockStackingLM.layoutNodes (HTMLBlockStackingLM.java:70) в org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren (HTMLStackingLM.java:26) в илиpse.birt.report.engine.layout.html.HTMLAbstractLM.layout (HTMLAbstractLM.java:140) в org.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.resumeLayout (HTMLInlineStackingLM.java) at.eclipse.birt.report.engine.layout.html.HTMLInlineStackingLM.layoutNodes (HTMLInlineStackingLM.java:160) в org.eclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChild26M или в HTML-формате (HTMLS).eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout (HTMLAbstractLM.java:140) в org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes (HTMLBlockStackingL) at.MTeclipse.birt.report.engine.layout.html.HTMLStackingLM.layoutChildren (HTMLStackingLM.java:26)по адресу org.eclipse.birt.report.engine.layout.html.HTMLRepeatHeaderLM.layoutChildren (HTMLRepeatHeaderLM.java:46) по адресу org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.ljAmв org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes (HTMLBlockStackingLM.java:70) в org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout (HTMLPage.M)в org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout (HTMLReportLayoutEngine.java:100) в org.eclipse.birt.report.engine.api.impl.RunAndRenderTask.doRun: RunAnd

1 Ответ

0 голосов
/ 03 апреля 2019
TextItemHandle nText = designFactory.newTextItem(null);
nText.setContentType(DesignChoiceConstants.TEXT_CONTENT_TYPE_HTML);
nText.setContent("<img src="+ "D:\\***Ws_16-11-18\\com.** (*.***.projectcreation\\icons\\sample.gif" + " />");
contentCell.getContent().add(nText);

Этот код работал для меня, чтобы вставить изображение

...