Hello,
I have made an invoice document in RDLC so it can be saved as PDF. This works fine, but there is a difference between printing to paper (or preview) and saving the report as PDF.
Some of the lines in the report have spaces in front of the text. When printed this is fine, but the SAVEASPDF function removes these spaces. I added 2 printscreens to show the problem.
Any idea how I can solve this? My idea would be to replace the first character with a non-visible character, but I'm not sure if this would be a good idea.
Print with spaces:
SaveAsPDF with spaces removed:
Kind regards,
Andy
Answers
Franz Kalchmair, MVP
Alias: Jonathan Archer
please like / agree / verify my answer, if it was helpful for you. thx.
Blog: http://moxie4nav.wordpress.com/
Might want to try that.
regards, wisa
Great suggestion, I could indeed solve it this way.
Maybe other members have the same issue, so this is how I did it. Its probably not the best or cleanest solution, but it works for me.
This is the function I create in the RDLC code:
Public Function LeftPadding( ByVal ptString as String, ByVal piLeft as Integer, ByVal pdecSpaceLength as Decimal) as String
Dim liSpaces As Integer
Dim ldecPadding as Decimal
ldecPadding = piLeft * 0.035
liSpaces = Len( ptString) - Len( Ltrim( ptString))
if (liSpaces > 0) Then
ldecPadding = ldecPadding + (liSpaces * pdecSpaceLength)
End If
Return Replace(Cstr( ldecPadding), ",", ".") & " cm"
End Function
Parameters:
- ptString is the string to print
- piLeftPadding is the initial padding in points (e.g. 2 for 2pt). This is converted in to cm by multiplying it by 0.035
- pdecSpaceLength is the length in cm a space should take. I made this variable to be able to print in different fonts and font sizes
The left padding property of my field is set to "=Code.LeftPadding( Fields!tText.Value, 2, 0.15)", the value to "=LTrim( Fields!tText.Value)"
Regards,
Andy