Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Jan 29, 2020 11:31 am

I have a PDFTable that has a datasource from SQLServer in VB - when I produce the PDF it shows ALL decimals with 4 digits after the decimal point, how do I get it to only show 2?

BigAl1958
 
Posts: 11
Joined: Thu Jun 08, 2017 3:45 pm

Thu Jan 30, 2020 3:31 am

Hello,

Thanks for your inquiry.
Since all the data and graphics of PDF are drawn on canvas. There is no direct way of setting to show decimals with 2 digits, it only draws as the original data. Thus, as for your situation, you could firstly convert your original data with 2 digits and then draw them into PDF. If there is any other question, just feel free to contact us.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Mon Feb 03, 2020 4:03 pm

Ok - the data I was extracted had the values showing as xx.xxD and so appeared to be 2 decimal places - on further investigation in Debug it show xx.xxD but if I used .toString on the values it showed 4 digits - the problem was the fields were defined as Money on the database and presumably e-spire effectively used the .tostring and so got 4 dp.

I solved the problem by changing all the fields to Decimal(8,2)

BigAl1958
 
Posts: 11
Joined: Thu Jun 08, 2017 3:45 pm

Tue Feb 04, 2020 1:22 am

Hello,

Glad to hear that you solved the issue. If you encounter any issue related to our products in the future, just feel free to contact us.
Wish you all the best!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF