I am using Aspose word 22.11. Created a template for Column chart using microsoft word where i can see the different color for negative values, but somehow while generating the document against the same template using Asposeword Java it shows the same color for all the positive and negative values. We are using the JSON data as a payload. Please suggest how to add different color for Negative and Positives value in chart.
Please share your sample template and JSON data along with the code. We will investigate the requirement and advise you.
@aspwanupsinha Thank you for additional information. We will check the issue and get back to you shortly.
We have logged the issue as WORDSNET-24867. You will be notified through the forum thread once we have any update.
Any update on this issue, we are urgently looking for this.
@aspwanupsinha The issue is currently in analysis. We will keep you updated and let you know once the issue is resolved or we have more information for you.
Any update on this issue, now we took the licensed version of aspose-word and using the same but still getting the same issue. As this is blocking our use case delivery so requesting you guys to please expedite this and provide us some solution against the same.
@aspwanupsinha The issue is in development now. It is scheduled to be fixed before the next 23.3 released. We will be sure to let you know once the version with the fix is released.
any tentative date for 23.3 release? so accordingly we will plan.
@aspwanupsinha .NET will be released at the end of this month or at the very beginning of the next. The Java version is usually released in two-three weeks after .NET version.
The issues you have found earlier (filed as WORDSNET-24867) have been fixed in this Aspose.Words for Java 23.3 update.
Hi team,
I am using aspose word linq engine (version: 23.3), where i am trying to put this value “0002020035206” in <<loanNumber] >> placeholder. But somehow it removes the pre 0’s from input and gives output as - “2020035206”. But we need same as what we passing so could you please help us for the same.
From your previous comments, it seems like you use JsonDataSource
. If so, then most likely, it is preferrable to switch to JsonSimpleValueParseMode.Strict
in your case as follows:
JsonDataLoadOptions options = new JsonDataLoadOptions();
options.SimpleValueParseMode = JsonSimpleValueParseMode.Strict;
JsonDataSource dataSource = new JsonDataSource(..., options);
See Accessing JSON Data and JsonSimpleValueParseMode Enum for more information.
Thanks for your prompt response!
Can’t we handle this scenario using LINQ syantax, as in few scenario we dont want strict checking and we have a common code for multiple use cases.
Unfortunately, there is no way to do it using template syntax. I would recommend separate templates requiring JsonSimpleValueParseMode.Strict
and JsonSimpleValueParseMode.Loose
(for example, by putting them at different locations) and implement a bit different processing for the two cases in your code.
Hi Team,
I am using aspose word linq engine (version: 23.3), Where i am using html placeholder <<[stndrdDisclosure] -html>> and trying to read html data as string like below but getting error while reading the using JsonDataSource.
code :
String data = "{\n" +
"\"stndrdDisclosure\":\"\n" +
"<!DOCTYPE html>\n" +
"\n" +
"<html>\n" +
"<head>\n" +
" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n" +
" <title>Spoon-Knife</title>\n" +
" <LINK href=\"styles.css\" rel=\"stylesheet\" type=\"text/css\">\n" +
"</head>\n" +
"\n" +
"<body>\n" +
"\n" +
"<img src=\"forkit.gif\" id=\"octocat\" alt=\"\" />\n" +
"\n" +
"<!-- Feel free to change this text here -->\n" +
"<p>\n" +
" Fork me? Fork you, @octocat!\n" +
"</p>\n" +
"<p>\n" +
" Sean made a change\n" +
"</p>\n" +
"\n" +
"</body>\n" +
"</html>\"\n" +
"}";
InputStream jsonIS = new ByteArrayInputStream(data.getBytes());
JsonDataSource jsonDataSource=new JsonDataSource(jsonIS); **// Gives error**
Error:
xception in thread "main" java.lang.IllegalStateException: There is an error on reading the JSON. After parsing a value an unexpected character was encountered: C. Path 'stndrdDisclosure', line 7, position 20.
at com.aspose.words.internal.zzYCf.zzW2d(Unknown Source)
at com.aspose.words.internal.zzYCf.zzW2d(Unknown Source)
at com.aspose.words.internal.zzYXW.zzW2d(Unknown Source)
at com.aspose.words.internal.zzYXW.<init>(Unknown Source)
at com.aspose.words.JsonDataSource.<init>(Unknown Source)
at com.aspose.words.JsonDataSource.<init>(Unknown Source)
at com.aspose.words.JsonDataSource.<init>(Unknown Source)
at com.bnymellon.wmdocvault.services.AsposeUpdateChartTemplate.main(AsposeUpdateChartTemplate.java:68)
Caused by: com.aspose.words.internal.zzX4K: After parsing a value an unexpected character was encountered: C. Path 'stndrdDisclosure', line 7, position 20.
at com.aspose.words.internal.zzX4K.zzW2d(Unknown Source)
at com.aspose.words.internal.zzX4K.zzW2d(Unknown Source)
at com.aspose.words.internal.zzX4K.zzW2d(Unknown Source)
at com.aspose.words.internal.zzZ6A.zzYUH(Unknown Source)
at com.aspose.words.internal.zzZ6A.read(Unknown Source)
at com.aspose.words.internal.zzWmX.zzW2d(Unknown Source)
at com.aspose.words.internal.zzWmX.zzXjW(Unknown Source)
at com.aspose.words.internal.zzWmX.zzW2d(Unknown Source)
at com.aspose.words.internal.zzWmX.zzW2d(Unknown Source)
at com.aspose.words.internal.zzWmX.zzW2d(Unknown Source)
at com.aspose.words.internal.zzXTB.zzW2d(Unknown Source)
at com.aspose.words.internal.zzYgn.zzXjW(Unknown Source)
at com.aspose.words.internal.zzMt.zzW2d(Unknown Source)
at com.aspose.words.internal.zzMt.zzW2d(Unknown Source)
at com.aspose.words.internal.zzYCf.zzW2d(Unknown Source)
Double quotes should be escaped with the '\'
character for JSON. Although it may seem that double quotes are escaped for JSON in the provided code snippet, in fact, they are not - they are escaped only for Java. To escape double quotes for JSON in Java, all "\""
occurrences should be replaced with "\\\""
. Here is a modified JSON string that does not raise an error:
String data = "{\n" +
"\"stndrdDisclosure\":\"\n" +
"<!DOCTYPE html>\n" +
"\n" +
"<html>\n" +
"<head>\n" +
" <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\"/>\n" +
" <title>Spoon-Knife</title>\n" +
" <LINK href=\\\"styles.css\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\">\n" +
"</head>\n" +
"\n" +
"<body>\n" +
"\n" +
"<img src=\\\"forkit.gif\\\" id=\\\"octocat\\\" alt=\\\"\\\" />\n" +
"\n" +
"<!-- Feel free to change this text here -->\n" +
"<p>\n" +
" Fork me? Fork you, @octocat!\n" +
"</p>\n" +
"<p>\n" +
" Sean made a change\n" +
"</p>\n" +
"\n" +
"</body>\n" +
"</html>\"\n" +
"}";
Thanks for your prompt response and solution!
We have a one requirement where we will read a string which contains aspose linq engine placeholders <<[placeholderString]>> as to inject some dynamic data to the generated document.
like :
String placeholderString: “aspose api”
String data=“generate dynamic data using <<[placeholderString]>>”
ouput : generate dynamic data using aspose api
can we do something like this?
This is possible using the following approach.
-
Instead of passing a string containing template syntax tags to the engine, pass a document instance containing just text based upon this string value as a data source. To build such a document, you can use
DocumentBuilder.write
. -
In your main template, use dynamic document insertion by applying the following syntax:
<<doc [doc_variable] -build -inline>>
Here, doc_variable
stands for the name of a data source representing a document instance created at step 1.
See Inserting Documents Dynamically for more information.