Open vexmenon opened 5 years ago
I tried to fix this in Bugfix_69. Have you tried with this branch?
Hi Imran, Ive run the test ExpressionReplacementWithDifferentStyleInParagraphFormattingTest in the bug fix above and the italic text retains its formatting but not the bold text. Can you please suggest what is to be done ?...ive checked out the commit on my local and i am testing the above change
Thanks !!
Hi vexmenon, actually you should see the ExpressionReplacementWithFormattingTest class and the ExpressionReplacementWithFormattingTest.docx file. ExpressionReplacementWithDifferentStyleInParagraphFormattingTest is not there any more! Or I am messing with git!! I just tested the italic in a bold, italic font and added a bold placeholder at the end. It worked just fine.
test:
and result:
Hi Iman, The text styling is not lost but im getting a run time errror. Stack trace is below : The error below does not occur on master branch. Exception message :
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walkParagraph(CoordinatesWalker.java:96) at java.util.ArrayList.rangeCheck(ArrayList.java:657) at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walkContent(CoordinatesWalker.java:71) at java.util.ArrayList.get(ArrayList.java:433) at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walk(CoordinatesWalker.java:39) at org.wickedsource.docxstamper.replace.PlaceholderReplacer.resolveExpressionsForParagraph(PlaceholderReplacer.java:107) at org.wickedsource.docxstamper.replace.PlaceholderReplacer.resolveExpressions(PlaceholderReplacer.java:88) at org.wickedsource.docxstamper.replace.PlaceholderReplacer$1.onParagraph(PlaceholderReplacer.java:85) at org.wickedsource.docxstamper.DocxStamper.replaceExpressions(DocxStamper.java:166) at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walkParagraph(CoordinatesWalker.java:96) at org.wickedsource.docxstamper.DocxStamper.stamp(DocxStamper.java:140) at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walkContent(CoordinatesWalker.java:71) ... 8 common frames omitted at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walk(CoordinatesWalker.java:39) null at org.wickedsource.docxstamper.replace.PlaceholderReplacer.resolveExpressions(PlaceholderReplacer.java:88) at org.wickedsource.docxstamper.DocxStamper.replaceExpressions(DocxStamper.java:166) at org.wickedsource.docxstamper.DocxStamper.stamp(DocxStamper.java:140)
yes, I am trying to fix it as soon as possible. It happens if a paragraph has no style. It has been already mentioned in #69 by @nor-deen
Hi @vexmenon , i just fixed the problem. It happened if placeholder where in the same run. Tests are O.K. too. Would be glad if you could check it as well.
Hi Iman, Still getting the same issue. I have modified the NameContext and added three more parameters and added the respective values in ExpressionReplacementWithFormattingTest.docx. Stack trace of issue : Attached the file for testing.
ExpressionReplacementWithFormattingTest.docx
org.wickedsource.docxstamper.api.DocxStamperException: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at org.wickedsource.docxstamper.DocxStamper.stamp(DocxStamper.java:147)
at org.wickedsource.docxstamper.DocxStamper.stamp(DocxStamper.java:120)
at org.wickedsource.docxstamper.ExpressionReplacementWithFormattingTest.test(ExpressionReplacementWithFormattingTest.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.junit.runner.JUnitCore.run(JUnitCore.java:130)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:237)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1 at java.util.ArrayList.rangeCheck(ArrayList.java:657) at java.util.ArrayList.get(ArrayList.java:433) at org.wickedsource.docxstamper.replace.PlaceholderReplacer.resolveExpressionsForParagraph(PlaceholderReplacer.java:107) at org.wickedsource.docxstamper.replace.PlaceholderReplacer$1.onParagraph(PlaceholderReplacer.java:85) at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walkParagraph(CoordinatesWalker.java:96) at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walkContent(CoordinatesWalker.java:71) at org.wickedsource.docxstamper.util.walk.CoordinatesWalker.walk(CoordinatesWalker.java:39) at org.wickedsource.docxstamper.replace.PlaceholderReplacer.resolveExpressions(PlaceholderReplacer.java:88) at org.wickedsource.docxstamper.DocxStamper.replaceExpressions(DocxStamper.java:166) at org.wickedsource.docxstamper.DocxStamper.stamp(DocxStamper.java:140)
ok. it takes more time as I supposed :( . I will try to fix that. Till then I withdraw the pull request
ok. it takes more time as I supposed :( . I will try to fix that. Till then I withdraw the pull request
Hey Iman, Any luck with the issue mentioned above ?.
Thanks & Regards
Hey Iman, Any luck with the issue mentioned above ?.
Thanks & Regards
Hi, I was really busy. I will try to fix it this week. Regards Iman
Thanks a lot.
https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=bf8b2c7d-3933-44ab-9d8a-532c2169528a I’m protected online with Avast Free Antivirus. Get it here — it’s free forever. https://www.avast.com/en-in/recommend?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail&utm_term=default3&tag=bf8b2c7d-3933-44ab-9d8a-532c2169528a <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
On Thu, Aug 1, 2019 at 12:53 AM Iman notifications@github.com wrote:
Hi, I was really busy. I will try to fix it this week. Regards Iman
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thombergs/docx-stamper/issues/73?email_source=notifications&email_token=AHXZMR4QECZMBOGOVGKFAVDQCHRD5A5CNFSM4HF5AYYKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3IJL3Q#issuecomment-516986350, or mute the thread https://github.com/notifications/unsubscribe-auth/AHXZMRYCRIISBHPPQCWZKW3QCHRD5ANCNFSM4HF5AYYA .
Hi! Any update on this? I'm getting the same issue, thanks!
This is an interesting problem to solve.
should be solved in https://mvnrepository.com/artifact/pro.verron/docx-stamper/1.6.3
Hi, The bold text after replacing the word is losing its format. Can anyone please help with it ?.