从SQL Server Reporting Services报告的第一页中删除多余的空格

时间:2021-01-25 08:11:41

I am using SQL Server Reporting Services 2008 (though this seems to be an issue for me in 2005 also). I have a report that has one page per customer (i.e. paged on customerId). The odd thing I'm seeing is that the first report (i.e. first page of the report) has a bit of extra white space at the top than the other pages. In general this seems to occur when you have a title for the report and paging (so that the first page has the title, but each successive page does not). The report I'm dealing with does not have a title like that, but still has this extra white space.

我正在使用SQL Server Reporting Services 2008(虽然这似乎也是我2005年的一个问题)。我有一个报告,每个客户有一页(即在customerId上分页)。我看到的奇怪的事情是,第一个报告(即报告的第一页)在顶部比其他页面有一些额外的空白区域。通常,当您拥有报告和分页的标题时(这样第一页具有标题,但每个连续的页面都没有),这似乎会发生。我正在处理的报告没有这样的标题,但仍然有这个额外的空白区域。

What I'm wondering is how do I prevent that extra white space on this first page of the report. How do I make each page of the report identical?

我想知道的是如何在报告的第一页上防止多余的空白区域。如何使报告的每个页面完全相同?

I do not have a header or footer applied to the report either.

我也没有应用于报表的页眉或页脚。

3 个解决方案

#1


1  

There are a couple of different causes for extra space at the top of the HTML render of a page in any version of Reporting Services. There are a couple of tricks to working around this depending upon the cause of the problem:

在任何版本的Reporting Services中,页面的HTML呈现顶部都有额外空间的几个不同原因。根据问题的原因,有几个技巧可以解决这个问题:

  1. Move the title from the Header to the Body of the report. If the title is a label, this doesn't always help.

    将标题从标题移动到报表的正文。如果标题是标签,这并不总是有帮助的。

  2. If you are using a table, then add a separate row to the header of the table. This seems to work very well, particularly when you render to Excel. However, not all report requirements can support this as a solution.

    如果您正在使用表,则在表的标题中添加单独的行。这似乎工作得很好,特别是当您渲染到Excel时。但是,并非所有报告要求都可以支持此解决方案。

  3. In SSRS 2000/2005, if you are using a container such as a rectangle or group, then the odds that you will having a spacing issue increase. If you can move the title out of the container, then this can help reduce the likelihood of a problem. I haven't tried using the Tablix grouping controls in SSRS 2008, so I can't tell if this will work in SSRS 2008.

    在SSRS 2000/2005中,如果您使用的是诸如矩形或组之类的容器,那么您将有间距问题的可能性会增加。如果您可以将标题移出容器,则可以帮助减少出现问题的可能性。我没有尝试过在SSRS 2008中使用Tablix分组控件,所以我不知道这是否适用于SSRS 2008。

  4. If you keep the header and footer objects on even you aren't adding any labels to the regions, then these can lead to extra spaces on the first page.

    如果您保持页眉和页脚对象,即使您没有向区域添加任何标签,这些也可能导致第一页上有额外的空格。

It is difficult to give you better advice without reproducing your exact problem. If you want to post the code for a sample RDL file temporarily, then I can try to reproduce the problem in SSRS 2008 on my machine and see if I can provide you with a custom solution to your problem.

如果不重现您的确切问题,很难给您更好的建议。如果您想暂时发布示例RDL文件的代码,那么我可以尝试在我的机器上重现SSRS 2008中的问题,看看我是否可以为您提供问题的自定义解决方案。

#2


2  

I've just found the problem i had with extra space on first page.

我刚刚在第一页找到了额外空间的问题。

In my case, the report has a header (with a textbox inside) and in the body a table. The problem was that on first page (printed from the app) appeared a little space between the header and the table on the body. Well, apart from that the result was perfect. But when exporting to Excel, first page only showed header, the rest of the pages looked perfect.

在我的例子中,报告有一个标题(里面有一个文本框)和一个表格。问题是,在第一页(从应用程序打印)上,标题和正文表格之间出现了一点空间。好吧,除此之外,结果是完美的。但是当导出到Excel时,第一页只显示标题,其余页面看起来很完美。

The solution: when you add a table (at least in the body), this table has automatically header and footer. I wasn't using header nor footer so i've removed them (first file and last file of the table) and voilá =-D

解决方案:当您添加表(至少在正文中)时,此表具有自动页眉和页脚。我没有使用页眉或页脚,所以我删除了它们(表的第一个文件和最后一个文件)和voilá= -D

that's all.

#3


1  

I'm using Reporting Services / SSRS 2008. I have a table (tablix) with column headers and a subreport in the last row. How do I get rid of the extra space on the first page? It looks ugly when exported to Excel. I've tried moving the table immediately below the report header and it does not work. It seems to enforce a tiny space between the two.

我正在使用Reporting Services / SSRS 2008.我有一个表(tablix),其中包含列标题和最后一行中的子报表。如何摆脱第一页上的额外空间?导出到Excel时看起来很难看。我已经尝试在报告标题下方移动表格,但它不起作用。它似乎在两者之间施加了一个微小的空间。

#1


1  

There are a couple of different causes for extra space at the top of the HTML render of a page in any version of Reporting Services. There are a couple of tricks to working around this depending upon the cause of the problem:

在任何版本的Reporting Services中,页面的HTML呈现顶部都有额外空间的几个不同原因。根据问题的原因,有几个技巧可以解决这个问题:

  1. Move the title from the Header to the Body of the report. If the title is a label, this doesn't always help.

    将标题从标题移动到报表的正文。如果标题是标签,这并不总是有帮助的。

  2. If you are using a table, then add a separate row to the header of the table. This seems to work very well, particularly when you render to Excel. However, not all report requirements can support this as a solution.

    如果您正在使用表,则在表的标题中添加单独的行。这似乎工作得很好,特别是当您渲染到Excel时。但是,并非所有报告要求都可以支持此解决方案。

  3. In SSRS 2000/2005, if you are using a container such as a rectangle or group, then the odds that you will having a spacing issue increase. If you can move the title out of the container, then this can help reduce the likelihood of a problem. I haven't tried using the Tablix grouping controls in SSRS 2008, so I can't tell if this will work in SSRS 2008.

    在SSRS 2000/2005中,如果您使用的是诸如矩形或组之类的容器,那么您将有间距问题的可能性会增加。如果您可以将标题移出容器,则可以帮助减少出现问题的可能性。我没有尝试过在SSRS 2008中使用Tablix分组控件,所以我不知道这是否适用于SSRS 2008。

  4. If you keep the header and footer objects on even you aren't adding any labels to the regions, then these can lead to extra spaces on the first page.

    如果您保持页眉和页脚对象,即使您没有向区域添加任何标签,这些也可能导致第一页上有额外的空格。

It is difficult to give you better advice without reproducing your exact problem. If you want to post the code for a sample RDL file temporarily, then I can try to reproduce the problem in SSRS 2008 on my machine and see if I can provide you with a custom solution to your problem.

如果不重现您的确切问题,很难给您更好的建议。如果您想暂时发布示例RDL文件的代码,那么我可以尝试在我的机器上重现SSRS 2008中的问题,看看我是否可以为您提供问题的自定义解决方案。

#2


2  

I've just found the problem i had with extra space on first page.

我刚刚在第一页找到了额外空间的问题。

In my case, the report has a header (with a textbox inside) and in the body a table. The problem was that on first page (printed from the app) appeared a little space between the header and the table on the body. Well, apart from that the result was perfect. But when exporting to Excel, first page only showed header, the rest of the pages looked perfect.

在我的例子中,报告有一个标题(里面有一个文本框)和一个表格。问题是,在第一页(从应用程序打印)上,标题和正文表格之间出现了一点空间。好吧,除此之外,结果是完美的。但是当导出到Excel时,第一页只显示标题,其余页面看起来很完美。

The solution: when you add a table (at least in the body), this table has automatically header and footer. I wasn't using header nor footer so i've removed them (first file and last file of the table) and voilá =-D

解决方案:当您添加表(至少在正文中)时,此表具有自动页眉和页脚。我没有使用页眉或页脚,所以我删除了它们(表的第一个文件和最后一个文件)和voilá= -D

that's all.

#3


1  

I'm using Reporting Services / SSRS 2008. I have a table (tablix) with column headers and a subreport in the last row. How do I get rid of the extra space on the first page? It looks ugly when exported to Excel. I've tried moving the table immediately below the report header and it does not work. It seems to enforce a tiny space between the two.

我正在使用Reporting Services / SSRS 2008.我有一个表(tablix),其中包含列标题和最后一行中的子报表。如何摆脱第一页上的额外空间?导出到Excel时看起来很难看。我已经尝试在报告标题下方移动表格,但它不起作用。它似乎在两者之间施加了一个微小的空间。