Using XML file dataset into a reporting

Stimulsoft Reports.NET discussion
Post Reply
JeffB
Posts: 17
Joined: Fri Dec 18, 2009 9:24 am
Location: Toulouse (France)

Using XML file dataset into a reporting

Post by JeffB »

Hi,

I have a problem with using of XML files as DataSet.

I have initialized the reporting with a dictionary coming from a XSD file and a XML file, creating the relations, and placing components into the report using the columns.
The preview shows the informations from the XML file.

Now I want to change the data coming from another XML file using the same XSD file, and all I have is a blank page.
If I test the new XML file into the report editor I have a good preview of it.

So I think the problem is coming from my code:

Code: Select all

			DataSet dataSet = new DataSet();
			//using (TextWriter tw = new StreamWriter("Project.xml", false))
			//{
			//	tw.Write(sw.ToString());
			//}

			//dataSet.ReadXml("Project.xml");
			//dataSet.ReadXmlSchema("Source.xsd");

			dataSet.ReadXml(new StringReader(sw.ToString()));

			StiReport report = new StiReport();
			report.Load("Report.mrt");
			report.Dictionary.Databases.Clear();
			report.RegData(dataSet);
			report.Dictionary.Synchronize();

			report.Render();
I have tested with and without report.Dictionary.Databases.Clear() and report.Dictionary.Synchronize() and the result is not good, showing the report with the data of the XML file saved into the report.
I have also tested with an external file and with a direct stream (as not commented) and I have the same result...
Can you tell how I can resolve my problem please?

Another thing, by the preview tab, if I export the report in Word format I don't have the picture in it, but if I export it in PDF format I have the picture. Can you try it ?

Thank you.
Attachments
Project.xml
XML test file.
(1.42 KiB) Downloaded 340 times
Report.mrt
Report file to use.
(82.07 KiB) Downloaded 384 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Using XML file dataset into a reporting

Post by Edward »

Hi Jeff,

Could you please also attach the xsd schema of the report, when you read the dataset from file, Source.xsd.
Could you try to swap the order for the dataset as follows

Code: Select all

dataSet.ReadXmlSchema("Source.xsd");         
dataSet.ReadXml("Project.xml");
Thank you,
Edward
JeffB
Posts: 17
Joined: Fri Dec 18, 2009 9:24 am
Location: Toulouse (France)

Re: Using XML file dataset into a reporting

Post by JeffB »

Hi Edward,

Thank you for your answer.

I have tried to swap those lines and all I have is a blank page.
You'll find the XSD file in attachment, simply rename the file on the code.
Attachments
Project.xsd
XSD file to use
(7.59 KiB) Downloaded 238 times
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Using XML file dataset into a reporting

Post by Edward »

Hi Jeff,

Thank you for the sample schema. I have noticed small issue that might be related to that empty report you are receiving. In fact the name of the XML datasource in the template is the same as the name of the connection and that can be changed if would change your code above as follows:

DataSet dataSet = new DataSet("Project1");

And then also please rename the XML connection :
Project -> Project1
in the report template.

It hopefully should work after that.

Thank you,
Edward
JeffB
Posts: 17
Joined: Fri Dec 18, 2009 9:24 am
Location: Toulouse (France)

Re: Using XML file dataset into a reporting

Post by JeffB »

Hi Edward,

Thank you so much, it works, but I don't have all my data on the rendered report. But I don't understand why, if I go to the preview tab into the designer which take the data from the Project.xml file, I have all my data on it, but on the export file I have only the first page... Can you take a look on this? it is with the same mrt, xml and xsd files.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Using XML file dataset into a reporting

Post by Edward »

Hi Jeff,

My first guess would be in that case that the xml and xsd are slightly different in that case, but we really need to double - check that first.

Thank you,
Edward
JeffB
Posts: 17
Joined: Fri Dec 18, 2009 9:24 am
Location: Toulouse (France)

Re: Using XML file dataset into a reporting

Post by JeffB »

Hi Edward,

After some tries today, I have the solution, and it was in the Stimulsoft samples:

Code: Select all

			StiReport report = new StiReport();

			report.Dictionary.Databases.Clear();
			report.RegData(dataSet);
			report.Dictionary.Synchronize();

			report.Load("Report.mrt");
So, I must load the mrt file after the RegData...

About my picture problem I have tried with some file formats export, and the result is :
- The Stimulsoft editor shows all images and texts in the preview
- Word or OpenOffice doesn't include images, and some texts are missing
- RTF format include them but some images are missing (the big ones)
- Excel includes all images
Please find the files in attachment.

Can you test it on your side and tell me if a solution exists?

Thank you.
Attachments
Report.xls
Excel export
(231 KiB) Downloaded 198 times
Report.rtf
RTF export
(408.43 KiB) Downloaded 242 times
Report.pdf
PDF export
(298.03 KiB) Downloaded 329 times
Report.docx
Word export
(178.2 KiB) Downloaded 167 times
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Using XML file dataset into a reporting

Post by HighAley »

Hello.

We looked at your files.
All images are in all reports.
Could you describe your issue more detailed?

Thank you.
JeffB
Posts: 17
Joined: Fri Dec 18, 2009 9:24 am
Location: Toulouse (France)

Re: Using XML file dataset into a reporting

Post by JeffB »

Hello,

I have tried the Word file on another computer, and all images are there. It seems there is a problem with my Word 2016 showing nothing :( ... I need to reinstall it.
Thank you for your time.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Using XML file dataset into a reporting

Post by Alex K. »

Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.
Post Reply