获取逗号而不是十进制 Dynamic CommonReport
getting commas instead of decimal Dynamic CommonReport
我正在创建一个 commonreport,但我得到的十进制值是用逗号而不是点。我尝试如下更改文化值,但在我的 pdf
中得到了相同的逗号
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
这是我的代码:
ReportGenerator gen = new ReportGenerator(tbl, dt);
ReportDataSource ds = new ReportDataSource(tbl, dt);
LocalReport report=new LocalReport();
Tuple<System.IO.Stream, float> res = gen.GeneraReport(compName, prm, abbr, font);
report.LoadReportDefinition(res.Item1);
Byte[] mybytes = report.Render("PDF"); //for exporting to PDF
using (FileStream fs = File.Create(fn))
{
fs.Write(mybytes, 0, mybytes.Length);
}
Response.Clear();
Response.Buffer = false;
Response.AddHeader("Accept-Ranges", "bytes");
Response.ContentType = "application/octet-stream";
Response.AddHeader("Connection", "Keep-Alive");
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader("Content-Type", "Application/x-pdf");
Response.AppendHeader("Content-disposition", "attachment; filename=" + fileName + ".pdf");
Response.WriteFile(fn);
Response.End();
我希望它是
ColumnName
1000.0
pdf 中的实际输出为
ColumnName
1000,0
提前致谢
我通过改变
改变了报告的文化
LoadReportDefinition
属性 成功了。
现在我在 PDF 中得到小数而不是逗号
我不得不在 "string content" 处放置一个断点并阅读其内容以找出报告使用的文化
Tuple<System.IO.Stream, float> res = gen.GeneraReport(compName, prm, abbr, font);
string content = new StreamReader(res.Item1, Encoding.UTF8).ReadToEnd();
content = content.Replace("<Language>it-IT</Language>", "<Language>en-IN</Language>");
//report.LoadReportDefinition(res.Item1);
report.LoadReportDefinition(new MemoryStream(Encoding.UTF8.GetBytes(content)));
感谢所有帮助过我的人
问候
我正在创建一个 commonreport,但我得到的十进制值是用逗号而不是点。我尝试如下更改文化值,但在我的 pdf
中得到了相同的逗号Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
这是我的代码:
ReportGenerator gen = new ReportGenerator(tbl, dt);
ReportDataSource ds = new ReportDataSource(tbl, dt);
LocalReport report=new LocalReport();
Tuple<System.IO.Stream, float> res = gen.GeneraReport(compName, prm, abbr, font);
report.LoadReportDefinition(res.Item1);
Byte[] mybytes = report.Render("PDF"); //for exporting to PDF
using (FileStream fs = File.Create(fn))
{
fs.Write(mybytes, 0, mybytes.Length);
}
Response.Clear();
Response.Buffer = false;
Response.AddHeader("Accept-Ranges", "bytes");
Response.ContentType = "application/octet-stream";
Response.AddHeader("Connection", "Keep-Alive");
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.AppendHeader("Content-Type", "Application/x-pdf");
Response.AppendHeader("Content-disposition", "attachment; filename=" + fileName + ".pdf");
Response.WriteFile(fn);
Response.End();
我希望它是
ColumnName
1000.0
pdf 中的实际输出为
ColumnName
1000,0
提前致谢
我通过改变
改变了报告的文化 LoadReportDefinition
属性 成功了。 现在我在 PDF 中得到小数而不是逗号 我不得不在 "string content" 处放置一个断点并阅读其内容以找出报告使用的文化
Tuple<System.IO.Stream, float> res = gen.GeneraReport(compName, prm, abbr, font);
string content = new StreamReader(res.Item1, Encoding.UTF8).ReadToEnd();
content = content.Replace("<Language>it-IT</Language>", "<Language>en-IN</Language>");
//report.LoadReportDefinition(res.Item1);
report.LoadReportDefinition(new MemoryStream(Encoding.UTF8.GetBytes(content)));
感谢所有帮助过我的人 问候