Showing posts with label explain. Show all posts
Showing posts with label explain. Show all posts

Sunday, March 11, 2012

Export To PDF Loses VbCRLF Formatting

Hi

I've simplified this so I can test it's not me and so it's easier to explain.

I have one table in SQL server called Table1. Five fields called: One, Two, Three, Four, Five. Values of NULL, 2, 3, 4, NULL.

Reporting services, put a table in a report. Two fields. Header of Field1 and Field2.

Value field data for Field1 ="One: " & vbcrlf & "Two: " & vbcrlf & "Three: " & vbcrlf & "Four: " & vbcrlf & "Five: "

Value field data for Field2 =Fields!One.Value & vbcrlf & Fields!Two.Value & vbcrlf & Fields!Three.Value & vbcrlf & Fields!Four.Value & vbcrlf & Fields!Five.Value

Preview the report, all is well, you get this:

Field1 Field2

One:

Two: 2

Three: 3

Four: 4

Five:

Export it to a PDF, all is not well, I get this:

Field1 Field2

One: 2

Two: 3

Three: 4

Four:

Five:

I can make it work by checking the NULL fields and replacing them with a character. But why does it ignore the vbCRLF when exported to a PDF?

Any ideas...

give minimum space (width and hight) for that field and try|||

Hello merin

Not sure how I give it minimum space?

Also the field is being outputted with enough space (I think), as 234 appear in that field. If I replace the NULLS with a hypen, it works perfectly. But that NULL in the table in field one is causing the VbCRLF to be ignored when it is exporting to a PDF.

With a hypen as a replacement for the NULL I get this preview and it outputs perfectly to a PDF. (This is how I've fixed the problem, but I'm still interested as to why this happens)

Field 1 Field2

One: -

Two: 2

Three: 3

Four: 4

Five: -

|||

Unfortunately, this is not something we support very well at all in SQL Server 2005. You'll see inconsistent behavior - for instance, exporting to TIFF will act as if the tabs are not present so the words will run together and exporting to PDF will act as if the tabs are spaces except for underline which won't cover the complete text.

Your best bet will be to do this via code. Switch to a fixed-width font and simulate tabs with multiple spaces.

Sorry I don't have a better answer.

|||

Thanks for this. The NULL replace with a hypen works for me for now. Hopefully in the next SP it will be a little more consistant with the formatting, here's hoping anyway.

Sunday, February 26, 2012

export to excel issues

can anyone explain, why when exporting a really simple spread to excel, one ends up with a ton of blank rows?

I have a report with 8 columns but when exporting to excel i end up with around 50 columns. All most are blank?

That is because Excel uses a whole lot of column merging to get the alignment as close as possible to the original report. It sounds like you have unmerged the columns/cells or have tried to copy and paste to another worksheet.

A simple way to fix this is to unmerge the cells, then copy just the columns you are interested in, or delete the blank columns altogether.

|||this may because of formating issues .try to format the fields properly or try to make some changes(like reduce or increase text size etc) in each field.|||

I'm not sure if you're seeing extra columns or rows or both, but it could be due to the size of your background (the white grid space in the body of the report). Make sure it is not bigger than your report items. I always get extra columns and rows in a dark grey in Excel if I don't size it correctly.

-Marianne