I have existing working project on java. I need to change template ".docx" document. When I'm trying to create a new WordDocument with another ".docx" document, I get an exception. What can be wrong? Sorry for my english.
There is a my code:
`WordDocument document = new WordDocument(templatesDirectory + "order.docx");`
There is a stacktrace:
`java.lang.NumberFormatException: For input string: "11340.0"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at com.independentsoft.office.word.tables.Width.a(Unknown Source)
at com.independentsoft.office.word.tables.Width.<init>(Unknown Source)
at com.independentsoft.office.word.tables.TableProperties.a(Unknown Source)
at com.independentsoft.office.word.tables.TableProperties.<init>(Unknown Source)
at com.independentsoft.office.word.tables.Table.a(Unknown Source)
at com.independentsoft.office.word.tables.Table.<init>(Unknown Source)
at com.independentsoft.office.word.Body.a(Unknown Source)
at com.independentsoft.office.word.Body.<init>(Unknown Source)
at com.independentsoft.office.word.WordDocument.a(Unknown Source)
at com.independentsoft.office.word.WordDocument.openImplementation(Unknown Source)
at com.independentsoft.office.word.WordDocument.open(Unknown Source)
at com.independentsoft.office.word.WordDocument.open(Unknown Source)
at com.independentsoft.office.word.WordDocument.<init>(Unknown Source)`
You should check out the message you get in the Exception: it says
Somewhere in your code you are trying to generate an
Integerfrom aStringthat cannot be converted to anInteger.In your case:
11340.0: although the mathematical value is an integer value, Java understands that it is aFloator aDoublebecause of the ending.0and raises an exception.Try to find where that convertion occurs from and see if you can catch / manage the exception.