RDLC 报告中第一条记录的位置为空
The place for the first record is empty in RDLC report
我做了一个像这样的 2 栏报告:
Name1----------------------------Name3
Address1-------------------------Address3
Name2----------------------------Name4
Address2-------------------------Address4
但是突然开始出现这样的报告:
----------------------------Name3
-------------------------Address3
Name1----------------------------Name4
Address1-------------------------Address4
Name2
Address2
这是我的代码:
public ActionResult Report()
{
LocalReport lr = new LocalReport();
string path = Path.Combine(Server.MapPath("~/Report"), "Person.rdlc");
if (System.IO.File.Exists(path))
{
lr.ReportPath = path;
}
else
{
return View("Index");
}
List<Person> cm = new List<Person>();
var viewModel = new PersonIndexData();
viewModel.People = db.Person
.Include(k => k.Groups)
.OrderBy(k => k.Name);
cm = viewModel.People.ToList();
ReportDataSource rd = new ReportDataSource("DataSet1", cm);
lr.DataSources.Add(rd);
string reportType = "pdf";
string mimeType = string.Empty;
string encoding = string.Empty;
string fileNameExtension = string.Empty;
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>pdf</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>12in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>0.5in</MarginLeft>" +
" <MarginRight>1in</MarginRight>" +
" <MarginBottom>0.2in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
renderedBytes = lr.Render(
"pdf",
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
return File(renderedBytes, mimeType);
}
即第一条记录的地方是空的。你认为它为什么会发生,我该如何摆脱它?我更改了列间距和边距,但没有用。谢谢
您无法从 table 中获取第一列值。这就是它无法显示第一列值的原因。
我做了一个像这样的 2 栏报告:
Name1----------------------------Name3
Address1-------------------------Address3
Name2----------------------------Name4
Address2-------------------------Address4
但是突然开始出现这样的报告:
----------------------------Name3
-------------------------Address3
Name1----------------------------Name4
Address1-------------------------Address4
Name2
Address2
这是我的代码:
public ActionResult Report()
{
LocalReport lr = new LocalReport();
string path = Path.Combine(Server.MapPath("~/Report"), "Person.rdlc");
if (System.IO.File.Exists(path))
{
lr.ReportPath = path;
}
else
{
return View("Index");
}
List<Person> cm = new List<Person>();
var viewModel = new PersonIndexData();
viewModel.People = db.Person
.Include(k => k.Groups)
.OrderBy(k => k.Name);
cm = viewModel.People.ToList();
ReportDataSource rd = new ReportDataSource("DataSet1", cm);
lr.DataSources.Add(rd);
string reportType = "pdf";
string mimeType = string.Empty;
string encoding = string.Empty;
string fileNameExtension = string.Empty;
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>pdf</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>12in</PageHeight>" +
" <MarginTop>0.5in</MarginTop>" +
" <MarginLeft>0.5in</MarginLeft>" +
" <MarginRight>1in</MarginRight>" +
" <MarginBottom>0.2in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
string[] streams;
byte[] renderedBytes;
renderedBytes = lr.Render(
"pdf",
deviceInfo,
out mimeType,
out encoding,
out fileNameExtension,
out streams,
out warnings);
return File(renderedBytes, mimeType);
}
即第一条记录的地方是空的。你认为它为什么会发生,我该如何摆脱它?我更改了列间距和边距,但没有用。谢谢
您无法从 table 中获取第一列值。这就是它无法显示第一列值的原因。