简体   繁体   English

如何在(rdlc)报告中水平显示表格

[英]How to show the table horizontally in (rdlc) report

I want to show the table horizontally like this: 我想像这样水平显示表格:

| data1 | data2 | data3 | data4 | ....

| data5 | data6 | ....

For more information, I am using visual studio 2010. and it will go to new line 有关更多信息,我正在使用visual studio 2010.它将转到新的一行

I saw similar question here but it goes to new page instead of new line 我在这里看到了类似的问题但它转到新页面而不是新行

Thanks for advance 谢谢你提前

in the rdl file or rdlc file in reportproperties set Columns to number of horizontal column you want to show 在reportproperties中的rdl文件或rdlc文件中,将“列”设置为要显示的水平列数 在此输入图像描述

for example you want to show 3 column show data and then go to next row 例如,您要显示3列显示数据,然后转到下一行

column1 | column2  | column3
column4 | column6  | column6

in report properties you set columns 3 and set report size width, size of column1 data automatically show in 3 column now you can use this report as sub report in other report 在报表属性中设置第3列并设置报表大小宽度,列1数据的大小自动显示在3列中现在您可以将此报表用作其他报表中的子报表

you must crate data table for this 你必须为此创建数据表

for example for 3 column you Crate DataTable for this purpose 例如,对于3列,您可以为此目的创建Data Cable

DataTable dt=new DataTable();
dt.Columns.Add("Data1");
dt.Columns.Add("Data2");
dt.Columns.Add("Data3");
DataRow drow=dt.NewRow();
for(int i=1;i<olddt.Rows.Count;i++)
{
  if(i%3==0 && i!=0)
  {
     dt.Rows.Add(drow); 
     drow=dt.NewRow();
  }
  if(i%3==0)
  {
    drow[0]=olddt[i][Column].ToString();
  }
  if(i%3==1)
  {
     drow[1]=olddt[i][Column].ToString();
  }
  if(i%3==2)
  {
    drow[2]=olddt[i][Column].ToString();
  }
}

in this example oldDt is your old data 在此示例中,oldDt是您的旧数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM