We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Type Conversion

How can i convert a string to integer in linq scripting.
I need to use sum() function but it is appending the values as string.



Linq scripting in word

Total: <<[Row.sum(s => s.amount)]>>

Hi there,

Thanks for your inquiry. We will appreciate it if you please share your sample code along with input and output documents here. It will help us to address your issue exactly…

Best Regards,

Please find the requested details below,

In the word template we use this function to get sum:

<<[Row.sum(s => s.VarNumber+0)]>>

But in the output we are getting the sum as below,


The xml data is,


Hi Nithin,

Thanks for sharing additional information. You need to convert string to integer in your template as following.

<<[Row.sum(s => Integer.parseInt(s.VarNumber))]>>

Please note you need to add java.lang.Integer class to Known External Type of Reporting Engine. Please check Setting up Known External Types section of following documentation for more details. It will help you to accomplish the task.Linqoutput.pdf (9.1 KB)

LINQ Reporting Engine API

com.aspose.words.Document doc = new com.aspose.words.Document("Linq_Row.docx");
ReportingEngine engine = new ReportingEngine();
DataSet ds = new DataSet();
engine.buildReport(doc, ds);

Best Regards,