LoadDocumentFromString

Stimulsoft Reports.Silverlight discussion
Locked
StepTK
Posts: 30
Joined: Fri Oct 25, 2013 10:22 am

LoadDocumentFromString

Post by StepTK »

Hello, i would like to use the method "LoadDocumentFromString" to create the StiReport object from an xml-string but the property "ReportFile" is not recreated correctly!
In the xml-string i can find the property (i inserted a guid string) but the object has an empty string!
Is this a bug? Is there a workaround to store a user generated string and recreate it from a string!? The "tag" property is not working as well!?

Thanks!!!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: LoadDocumentFromString

Post by Alex K. »

Hello,

Can you please describe your issue in more details.
Also if you want to load the report template you need use the LoadFromString() method, the LoadDocumentFromString method load the already rendered report.

Thank you.
StepTK
Posts: 30
Joined: Fri Oct 25, 2013 10:22 am

Re: LoadDocumentFromString

Post by StepTK »

I call the method "LoadDocumentFromString":
Dim stiReport As New Stimulsoft.Report.StiReport()
stiReport.LoadDocumentFromString(reportAsXml) !!!!(used with the xml String below)!!!

When i now check the "stiReport.ReportFile" property it has an empty string (but the xml string below has this property filled!!!).


reportAsXml:
"<?xml version="1.0" encoding="utf-8" standalone="yes"?>" & vbCrLf & "<StiSerializer version="1.02" type="Silverlight" application="StiReport">" & vbCrLf & " <Dictionary Ref="1" type="Dictionary" isKey="true">" & vbCrLf & " <BusinessObjects isList="true" count="1">" & vbCrLf & " <SampleData Ref="2" type="Stimulsoft.Report.Dictionary.StiBusinessObject" isKey="true">" & vbCrLf & " <Alias>SampleData</Alias>" & vbCrLf & " <BusinessObjects isList="true" count="0" />" & vbCrLf & " <Category>SampleData</Category>" & vbCrLf & " <Columns isList="true" count="3">" & vbCrLf & " <value>MEAANA,Analysator,System.String</value>" & vbCrLf & " <value>MEAENDTIM,AnaEndeZeit,System.String</value>" & vbCrLf & " <value>MEANOTE1,AnaNotiz1,System.String</value>" & vbCrLf & " </Columns>" & vbCrLf & " <Dictionary isRef="1" />" & vbCrLf & " <Guid>f970094ecbf34b66b1ba88b3c3397a98</Guid>" & vbCrLf & " <Name>SampleData</Name>" & vbCrLf & " </SampleData>" & vbCrLf & " </BusinessObjects>" & vbCrLf & " <Databases isList="true" count="0" />" & vbCrLf & " <DataSources isList="true" count="0" />" & vbCrLf & " <Relations isList="true" count="0" />" & vbCrLf & " <Report isRef="0" />" & vbCrLf & " <Variables isList="true" count="9">" & vbCrLf & " <value>REQUESTVARS,Language,Language,System.String,Language,True,False</value>" & vbCrLf & " <value>REQUESTVARS,StartTime,StartTime,System.String,StartTime,True,False</value>" & vbCrLf & " <value>REQUESTVARS,EndTime,EndTime,System.String,EndTime,True,False</value>" & vbCrLf & " <value>REQUESTVARS,Sorts,Sorts,System.String,Sorts,True,False</value>" & vbCrLf & " <value>REQUESTVARS,StartDevices,StartDevices,System.String,StartDevices,True,False</value>" & vbCrLf & " <value>REQUESTVARS,DataDevices,DataDevices,System.String,DataDevices,True,False</value>" & vbCrLf & " <value>REQUESTVARS,DynamicFilter,DynamicFilter,System.String,DynamicFilter,True,False</value>" & vbCrLf & " <value>REQUESTVARS,SortingList,SortingList,System.String,SortingList,True,False</value>" & vbCrLf & " <value>REQUESTVARS,Compression,Compression,System.String,Compression,True,False</value>" & vbCrLf & " </Variables>" & vbCrLf & " </Dictionary>" & vbCrLf & " <EngineVersion>EngineV2</EngineVersion>" & vbCrLf & " <GlobalizationStrings isList="true" count="0" />" & vbCrLf & " <MetaTags isList="true" count="0" />" & vbCrLf & " <Pages isList="true" count="1">" & vbCrLf & " <Page1 Ref="3" type="Page" isKey="true">" & vbCrLf & " <Border>None;Black;2;Solid;False;4;Black</Border>" & vbCrLf & " <Brush>Transparent</Brush>" & vbCrLf & " <Components isList="true" count="0" />" & vbCrLf & " <Conditions isList="true" count="0" />" & vbCrLf & " <Guid>cb967faa58f541e6844f92d785b0823e</Guid>" & vbCrLf & " <Margins>1,1,1,1</Margins>" & vbCrLf & " <Name>Page1</Name>" & vbCrLf & " <PageHeight>29.7</PageHeight>" & vbCrLf & " <PageWidth>21</PageWidth>" & vbCrLf & " <Report isRef="0" />" & vbCrLf & " <Watermark Ref="4" type="Stimulsoft.Report.Components.StiWatermark" isKey="true">" & vbCrLf & " <Font>Arial,100</Font>" & vbCrLf & " <TextBrush>[50:0:0:0]</TextBrush>" & vbCrLf & " </Watermark>" & vbCrLf & " </Page1>" & vbCrLf & " </Pages>" & vbCrLf & " <PreviewSettings>268427775</PreviewSettings>" & vbCrLf & " <PrinterSettings Ref="5" type="Stimulsoft.Report.Print.StiPrinterSettings" isKey="true" />" & vbCrLf & " <ReferencedAssemblies isList="true" count="8">" & vbCrLf & " <value>System.Dll</value>" & vbCrLf & " <value>System.Drawing.Dll</value>" & vbCrLf & " <value>System.Windows.Forms.Dll</value>" & vbCrLf & " <value>System.Data.Dll</value>" & vbCrLf & " <value>System.Xml.Dll</value>" & vbCrLf & " <value>Stimulsoft.Controls.Dll</value>" & vbCrLf & " <value>Stimulsoft.Base.Dll</value>" & vbCrLf & " <value>Stimulsoft.Report.Dll</value>" & vbCrLf & " </ReferencedAssemblies>" & vbCrLf & " <ReportAlias>ASD-Report</ReportAlias>" & vbCrLf & " <ReportChanged>12/09/2013 09:07:28</ReportChanged>" & vbCrLf & " <ReportCreated>12/09/2013 09:07:28</ReportCreated>" & vbCrLf & " <ReportFile>abfc32f0-3dbe-4819-b311-685621cdb1a4</ReportFile>" & vbCrLf & " <ReportGuid>cf293e1ff8c34461bb521529efc27e65</ReportGuid>" & vbCrLf & " <ReportName>ASD-Report</ReportName>" & vbCrLf & " <ReportUnit>Centimeters</ReportUnit>" & vbCrLf & " <ReportVersion>2013.1.1600</ReportVersion>" & vbCrLf & " <Script>using System;" & vbCrLf & "using System.Drawing;" & vbCrLf & "using System.Windows.Forms;" & vbCrLf & "using System.Data;" & vbCrLf & "using Stimulsoft.Controls;" & vbCrLf & "using Stimulsoft.Base.Drawing;" & vbCrLf & "using Stimulsoft.Report;" & vbCrLf & "using Stimulsoft.Report.Dialogs;" & vbCrLf & "using Stimulsoft.Report.Components;" & vbCrLf & "" & vbCrLf & "namespace Reports" & vbCrLf & "{" & vbCrLf & " public class ASD_Report : Stimulsoft.Report.StiReport" & vbCrLf & " {" & vbCrLf & " public ASD_Report()" & vbCrLf & "" & vbCrLf & " {" & vbCrLf & " this.InitializeComponent();" & vbCrLf & " }" & vbCrLf & "" & vbCrLf & " #region StiReport Designer generated code - do not modify" & vbCrLf & " #endregion StiReport Designer generated code - do not modify" & vbCrLf & " }" & vbCrLf & "}" & vbCrLf & "</Script>" & vbCrLf & " <ScriptLanguage>CSharp</ScriptLanguage>" & vbCrLf & " <Styles isList="true" count="0" />" & vbCrLf & "</StiSerializer>"
StepTK
Posts: 30
Joined: Fri Oct 25, 2013 10:22 am

Re: LoadDocumentFromString

Post by StepTK »

When i call the method " stiReport.SaveToString" the property "ReportFile" which was filled before is then deleted.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: LoadDocumentFromString

Post by Alex K. »

Hello,

Please clarify what do you want to load REPORT TEMPLATE or already RENDERED REPORT?
The LoadDocumentFromString method load the already rendered report. Please try to use the LoadFromString() method.

Thank you.
StepTK
Posts: 30
Joined: Fri Oct 25, 2013 10:22 am

Re: LoadDocumentFromString

Post by StepTK »

Thanks for your answer.
It is a report template. The method "LoadFromString()" does not work as well....
HighAley
Posts: 8431
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: LoadDocumentFromString

Post by HighAley »

Hello.

Could you describe more detailed what are you trying to do? And what does not work?
What are you going to do with the report?

Thank you.
StepTK
Posts: 30
Joined: Fri Oct 25, 2013 10:22 am

Re: LoadDocumentFromString

Post by StepTK »

Hello,

enclosed you will find a step by step description to reproduce the bug:
BUG-1-
1) Dim stiReport As New Stimulsoft.Report.StiReport()
2) stiReport.LoadFromString(reportAsXml) The content of the reportAsXml-String you will find in the other post (in the string you will find the xml-tag "ReportFile" with a GUID-String-Value).



If i now try to read the value "stiReport.ReportFile":
3) System.Diagnostics.Debug.WriteLine(stiReport.ReportFile)

!!! it contains an empty string (but in the xml string it is filled with the GUID-STRING!) !!!


ANOTHER BUG-2-:
If i now fill the property with:
1) stiReport.ReportFile = "asjkdlkasdj"
Call the Method:
2) stiReport.SaveToString()
Now if I call:
3) System.Diagnostics.Debug.WriteLine(stiReport.ReportFile)

The Property stiReport.ReportFile is empty again!!!!

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: LoadDocumentFromString

Post by Alex K. »

Hello,

Can you please send us a sample project which reproduce the issue for analysis.
Also please check the last version.

Thank you.
Locked