Print Page | Close Window

Vertical Spacing of Text in a Table?

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2015
Printed Date: 11 Jun 25 at 4:03AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Vertical Spacing of Text in a Table?
Posted By: Dan
Subject: Vertical Spacing of Text in a Table?
Date Posted: 26 Oct 11 at 10:41PM
I am programatically creating a pdf that has a table. I'm running in to a problem with text wrapping. In cells where the text is wrapping to a 2nd line, only the first line is visible unless I SetTableRowHeight to a higher value or reduce the font size.

I'd need to be able to squeeze the text in if at all possible.

I have set the bottom padding to 0 and it looks like there is enough vertical space for line 2 yet it doesn't render. Is it possible to set or reduce the space between the lines for text added with SetTableCellContent()?

Thanks,
Dan



Replies:
Posted By: greenley
Date Posted: 06 Nov 11 at 3:19PM
Did you ever find an answer to this, I have the same question?I think it could be done with an HTML equivalent of SetTextSpacing, but I can't find one.

Used GetHTMLTextHeight and got a height of 32, padding set to zero all around, cell border width = .1, two lines do not appear unless cell height is set to 38 or higher, that doesn't let me fit on a page what I need. Yes I could create the table as a series of boxes, and draw the text as separate lines of text, or maybe then use setTextSpacing, but that is a LOT more work, and this project was finally coming together.

Lines of code I referred to are:
QP.SetTableCellBorderWidth(tableID, 1,1,10,3,0, 0.2);
QP.SetTableCellPadding(tableID,1,1,10,3,0,0);
QP.SetTableRowHeight(tableID, 10, 10, 38);
int junk1 = QP.GetHTMLTextHeight(131.4,L"<font size=\"12pt\"><b>Are there services this plan doesn't cover?</b></font>");

Thanks


Posted By: AndrewC
Date Posted: 08 Nov 11 at 3:35AM
I am no expert with HTML but after reviewing the QPL source code I found that the <p spacing= >  tag is supported and after a little bit of testing found out that this works to control the line spacing.  I will get this added to the documentation.

string text = "<p spacing=\"-2pt\">begins to pay for covered services you use. Check your policy to see when the  <font color=\"#0775A8\">deductible</font> starts over (usually, but not always, January 1st). See the chart starting on page 2 for how much you pay for covered services after you meet the <font color=\"#0775A8\">deductible</font>.</font>";
            QP.DrawHTMLTextBox(10 ,10, 300 , 200, text);

Andrew.




Posted By: Dan
Date Posted: 08 Nov 11 at 2:42PM
Excellent! I'll give this a try.

Thanks,
Dan


Posted By: greenley
Date Posted: 08 Nov 11 at 4:43PM
While it is not in my understanding the way regular html would format it, for this usage it works great. Have just tested with 8.12 and it takes care of what I needed perfectly.Smile



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk