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

Free Support Forum - aspose.com

LINQ Reporting engine with XmlDataSource

Hi, i’ve tryed the new Linq reporting engine but i get an error when i try to launch PdfAgentTest main program. Please see attached application.
I would like to use XmlDataSource as input…

What am i doing wrong ?

thanks

Simone

Hi Simone,

Thanks for your inquiry. You implemented IMailMergeDataSource interface in your application. This is traditional mail merge approach using custom data source. I suggest you please read following documentation links for your kind reference.
https://docs.aspose.com/words/java/linq-reporting-engine-api/
https://docs.aspose.com/words/java/appendix-b-technical-faq/
https://docs.aspose.com/words/java/appendix-c-typical-templates/

To work with traditional mail merge data sources, please read following link.
https://docs.aspose.com/words/java/working-with-traditional-mail-merge-data-sources/

I am in communication with our product team about using XML data source in Linq reporting engine. We will get back to you asap.

Hi Tahir,

i’ve already read the documentation and as you argued, i was looking for a generic way of using linq reporting engine passing xml datasource.
Hope to have news about it soon, thank you very much !

Simone

Hi Simone,

Thanks for your patience. Please note that IMailMergeDataSource is not supported by LINQ Reporting Engine by design.

LINQ Reporting Engine is able to use objects of custom visible types as data sources. See the more detail from here:
https://docs.aspose.com/words/java/working-with-types/

You may also read the xml and load it into com.aspose.words.DataTable and use DataTable object in ReportingEngine.buildReport method. Please check following code example for your kind reference. I have attached the in.xml with this post.

Please let us know if you have any more queries.

DataTable datatable = new DataTable();
datatable.getColumns().add("FirstName");
datatable.getColumns().add("LastName");
int rowindex = 1;
javax.xml.parsers.DocumentBuilder db = javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder();
org.w3c.dom.Document dom = db.parse(MyDir + "in.xml");
Element docEle = dom.getDocumentElement();
org.w3c.dom.NodeList nl = docEle.getChildNodes();
if (nl != null && nl.getLength() > 0)
{
    for (int i = 0; i < nl.getLength(); i++)
    {
        if (nl.item(i).getNodeType() == org.w3c.dom.Node.ELEMENT_NODE)
        {
            Element el = (Element)nl.item(i);
            if (el.getNodeName().contains("Person"))
            {
                String fname = el.getElementsByTagName("FirstName").item(0).getTextContent();
                String lname = el.getElementsByTagName("LastName").item(0).getTextContent();
                DataRow row = datatable.newRow();
                datatable.getRows().add(row);
                row.set("FirstName", fname);
                row.set("LastName", lname);
                rowindex++;
            }
        }

    }
}

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln("<<foreach [in Person]>><<[FirstName]>> <<[LastName]>>");
builder.writeln("<</foreach>>");
ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, datatable, "Person");
doc.save(MyDir + "Out.docx");

Thanks Tahir, but i need a generic way of creating a DataTable object from generic xml (like IMailMergeDataSource and XmlMailMergeDataTable do for mailmerging).

I mean i need to transform ad unknown xml in an object (DataTable) to pass to Linq Report Engine.

Could you please help me ?

thanks

Simone

Hi Simone,

Thanks for your inquiry. Unfortunately, Aspose.Words for Java does not provide API to read XML and store it in an object. However, I have logged this feature request as WORDSJAVA-1077 in our issue tracking system. Our development team will look into the
possibility of implementation of this feature. Once we have
any information about this feature, we will update you via this thread.

Please let us know if you have any more queries.

Hi Tahir,

do you have any news about this issue ?
thanks

Hi Simone,

Thanks
for your inquiry. I would like to
share with you that issues
are addressed and resolved based on first come first serve
basis. Currently, this feature is pending for analysis and is in the
queue. I am afraid, we can’t provide you any reliable estimate at the
moment. Once our product team complete the analysis, we will then be able to provide you
an estimate.

Thanks for your patience and understanding.

Still no news about this issue ? thanks

Hi Simone,

Thanks
for your inquiry. I have verified the status of this feature from our
issue tracking system and like to share with you that our product team has completed the analysis of this feature. This is a quite complex task and also needs to complete some sub tasks. I have asked for the ETA of this feature from our product team. As
soon as any information is shared by them, we will be more than happy to
share that with you.

Thanks for your patience and understanding.

any news ? thanks

Hi Simone,

Thanks

for your inquiry. This is a quite complex task:
https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/dataset-datatable-dataview/loading-a-dataset-from-xml
I am afraid, we cannot share any ETA of this feature at the moment. This feature also involve some sub tasks as well. Our development team is working on this feature. We will update you via this forum thread once this feature is available.

Thanks for your patience and understanding.

Thanks, let’s hope it will be ready soon.
Anyway i need it for java, not .Net

thanks

Hi Simone,

Yes, this issue is for Aspose.Words for Java. Issue ID is WORDSJAVA-1077 (Add feature to read xml using DataSet.ReadXml same as .NET).

Hi Tahir…only to let you know that i’m waiting for this feature in order to supply the application to our customer.

Could you please tell me when approximately will it be released ?

Thanks

Hi Simone,

Thanks

for your inquiry. We do understand your situation, however I
am afraid, at the moment we can’t provide you the ETA of this feature. I
have spoken to the responsible developer about this feature and I am
afraid he is unable to commit any ETA at the moment.

Normally
when a feature is requested by a customer it is added to the pool of
current issues/features being worked on by our developers and is analysed in
a timely manner. However due to the nature of some bugs and the number
of features we are working on, this doesn’t always mean we can fix every
bug or implement a feature within a short time after it’s reported.

Thanks for your patience and understanding.

Thanks for your feedback, Tahir.

Wasn’t it easier to introduce this feature in Mail Merge which already can deal with xml files through IMailMergeDataSource and XmlMailMergeDataTable ?

Thanks

Hi Simone,

Thanks

for your inquiry. The new Linq reporting engine is different from classic mail merge engine. You can implement IMailMergeDataSource and use XmlMailMergeDataTable code to work with classic mail merge. However, it is different from new Linq reporting engine. Note that the IMailMergeDataSource is not supported by LINQ Reporting Engine by design.

We will inform you via this forum thread once this feature is available. Thanks for your patience.

Still no news about this issue, right ?
thanks

Simone

Hi Simone,

Please have a look at the latest AW for Java release.

Since this release you are able to load data into DataSet via readXml, readXmlSchema methods.

Thanks