David Masters
David Masters

Reputation: 8295

ReportViewer.Render html outputs strange table layout

I'm new to reporting services and having trouble getting a report to render correctly on my ASPX page.

It seems no matter what I do to the layout of the report in the designer, the changes get ignored and the columns remain scrunched together with a big empty white space column to the right of it. Here's what I mean:

Reasonable widths on columns

No matter what I change the widths of the columns to, it always renders like this:

Turd formatting

By looking at the mark up I can see that a fixed width is being applied, and that the white space is TD with a width of 100%.

Here's the code I'm using/I've inherited:

result = rvDashlet.ServerReport.Render("HTML4.0", "<DeviceInfo><HTMLFragment>True</HTMLFragment></DeviceInfo>", out mimeType, out encoding, out extension, out streamids, out warnings);

The frustrating thing is, previously this report was being rendered as an image, which was working and looking fine. I've had to change it to HTML to allow for hyper-links to be added.

Any suggestions appreciated!

Upvotes: 1

Views: 3609

Answers (2)

Jeff Miles
Jeff Miles

Reputation: 205

I found this problem occurred when using SSRS 2005 with the following attributes on the reportviewer control:

syncRendering="False" SizeToReportContent="True" Width="100%"

This occured in IE, where the first TD containing the body of the report had no width specified, but the second TD had a width of 100%.

The id of the first TD is some random element such as Pdde6991e54b24a49a0a0b54433781b57oReportCell", which I've targeted with the following CSS:

td[id*='oReportCell'] {width:100% !important;}

Now the report takes the full width of the container, and the second empty TD shrinks to nothing.

Upvotes: 5

David Masters
David Masters

Reputation: 8295

Since upgrading to reporting services 2008 from 2005, it seems to have solved the problem.

Upvotes: 1

Related Questions