Hi to all,
something strange happens to me.
I have a report that contains a subreport. Subreport generates several records, each record is 1/4 tall of an A4 page.
If I try to render report into Visual Studio 2017 I see all correct, and if I try to save in RTF format it generates all.
But if I try to generate RTF file by code, if I open rtf file with Word content of subreport is truncated after some records.
What's happend?
01.
public
static
Bundle SaveAsWord(
string
fileName, Bundle pBundle)
02.
{
03.
Bundle bundle =
new
Bundle();
04.
05.
try
06.
{
07.
//Create new CultureInfo
08.
var cultureInfo =
new
System.Globalization.CultureInfo(pBundle.Get(2).ToString());
09.
10.
// Set the language for static text (i.e. column headings, titles)
11.
System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;
12.
13.
// Set the language for dynamic text (i.e. date, time, money)
14.
System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
15.
16.
Telerik.Reporting.Processing.ReportProcessor reportProcessor =
new
Telerik.Reporting.Processing.ReportProcessor();
17.
18.
// set any deviceInfo settings if necessary
19.
System.Collections.Hashtable deviceInfo =
new
System.Collections.Hashtable();
20.
21.
Telerik.Reporting.TypeReportSource typeReportSource =
new
Telerik.Reporting.TypeReportSource();
22.
23.
// reportName is the Assembly Qualified Name of the report
24.
typeReportSource.TypeName =
typeof
(OffertaVenditaBrema).AssemblyQualifiedName;
25.
typeReportSource.Parameters.Add(
"NumeroOfferta"
, pBundle.Get(1).ToString());
26.
typeReportSource.Parameters.Add(
"MostraPrezziListino"
, pBundle.Get(3).ToString());
27.
typeReportSource.Parameters.Add(
"MostraPrezziNetti"
, pBundle.Get(4).ToString());
28.
typeReportSource.Parameters.Add(
"SfondoGrigio"
, pBundle.Get(5).ToString());
29.
typeReportSource.Parameters.Add(
"TestoBianco"
, pBundle.Get(6).ToString());
30.
typeReportSource.Parameters.Add(
"MostraTabellaPrezzi"
, pBundle.Get(7).ToString());
31.
32.
Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport(
"RTF"
, typeReportSource, deviceInfo);
33.
34.
//string fileName = result.DocumentName + "." + result.Extension;
35.
string
path = System.IO.Path.GetTempPath();
36.
string
filePath = System.IO.Path.Combine(path, fileName);
37.
38.
using
(System.IO.FileStream fs =
new
System.IO.FileStream(filePath, System.IO.FileMode.Create))
39.
fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
40.
41.
bundle.Add(1,
true
);
42.
bundle.Add(2, filePath);
43.
}
44.
catch
(Exception ex)
45.
{
46.
bundle.Add(1,
false
);
47.
bundle.Add(2, ex.Message);
48.
bundle.Add(3, ex.StackTrace.ToString());
49.
}
50.
51.
return
bundle;
52.
}