Hi Ron,
I too must apologize for the late reply. The past few weeks left me too drained to do much after regular working hours. But today I finally found the time to look into this again. As it turns out, you weren't doing anything wrong, and it is a bug in the library, since the very first release.
The line height was, in fact, a magic number of 5, which worked fine in my examples and tests, but didn't take into account the font size (what was I thinking?). To add insult to injury, this magic number ignored the 'unit' of the document so it was even further off if you didn't use the default unit of millimeters but points instead.
For a temporary patch, replace the current implementation of the 'qrtPDF_WriteTextTable' command with the following:
Code: Select all
command qrtPDF_WriteTextTable pDocID, pText, pColumnWidths, pColumnAligns, pBorder, pFill
p_qrtPDF_AssertDocID pDocID
p_qrtPDF_AssertIntegerList "columnWidths", pColumnWidths, 0
p_qrtPDF_AssertTextArray pText
if pColumnAligns is empty then
put sDocumentsA[pDocID][kp_TextAlign] into pColumnAligns
end if
p_qrtPDF_AssertAlignList pColumnAligns
-- backward compatibility: border parameter is new in version 1.1.1
if pFill is empty and pBorder is a boolean then
put pBorder into pFill
put empty into pBorder
end if
if pBorder is empty then put "grid" into pBorder
p_qrtPDF_AssertTableBorder pBorder
if pFill is empty then put false into pFill
p_qrtPDF_AssertFlag "fill", pFill
-- proceed now that we're sure all is right
local tExtents, tNumberOfRows, tNumberOfColumns
put the extents of pText into tExtents
put item 2 of line 1 of tExtents into tNumberOfRows
put item 2 of line 2 of tExtents into tNumberOfColumns
local tRow, tColumn, tColumnWidth, tColumnAlign, tX, tY
local tSingleLineHeight
put sDocumentsA[pDocId][kp_FontSize] * 6 / 5 into tSingleLineHeight
repeat with tRow = 1 to tNumberOfRows
-- calculate the height of the row
local tRowLines, tHeight
put 0 into tRowLines
repeat with tColumn = 1 to tNumberOfColumns
put item tColumn of pColumnWidths into tColumnWidth
if tColumnWidth is empty then
put item -1 of pColumnWidths into tColumnWidth
end if
put max(tRowLines, p_qrtPDF_NumberOfLines(pDocID,tColumnWidth,pText[tRow,tColumn])) into tRowLines
end repeat
put tRowLines * tSingleLineHeight into tHeight
-- page break if needed
p_qrtPDF_CheckPageBreak pDocID, tHeight
-- draw the cells in the row
repeat with tColumn = 1 to tNumberOfColumns
put item tColumn of pColumnWidths into tColumnWidth
if tColumnWidth is empty then
put item -1 of pColumnWidths into tColumnWidth
end if
put item tColumn of pColumnAligns into tColumnAlign
if tColumnAlign is empty then
put item -1 of pColumnAligns into tColumnAlign
end if
put sDocumentsA[pDocID][kp_CurrentX] into tX
put sDocumentsA[pDocID][kp_CurrentY] into tY
-- determine the border
local tCellBorder
switch pBorder
case "none"
put empty into tCellBorder
break
case "frame"
put empty into tCellBorder
if tRow is 1 then
put "top," after tCellBorder
end if
if tRow is tNumberOfRows then
put "bottom," after tCellBorder
end if
if tColumn is 1 then
put "left," after tCellBorder
end if
if tColumn is tNumberOfColumns then
put "right," after tCellBorder
end if
delete char -1 of tCellBorder
break
case "grid"
put "top,bottom,left,right" into tCellBorder
break
end switch
-- draw the border here, not in the text area
-- (otherwise it won't match the row height)
if "top" is among the items of tCellBorder then
qrtPDF_DrawLine pDocId, tX, tY, tX + tColumnWidth, tY
end if
if "bottom" is among the items of tCellBorder then
qrtPDF_DrawLine pDocId, tX, tY + tHeight, tX + tColumnWidth, tY + tHeight
end if
if "left" is among the items of tCellBorder then
qrtPDF_DrawLine pDocId, tX, tY, tX, tY + tHeight
end if
if "right" is among the items of tCellBorder then
qrtPDF_DrawLine pDocId, tX + tColumnWidth, tY, tX + tColumnWidth, tY + tHeight
end if
-- draw the text area without a border
qrtPDF_WriteTextArea pDocID, tColumnWidth, tSingleLineHeight, pText[tRow,tColumn], empty, tColumnAlign
-- move to the right of this cell
qrtPDF_SetXY pDocID, tX + tColumnWidth, tY
end repeat
-- go to the next line
qrtPDF_DoLineBreak pDocID, tHeight
end repeat
end qrtPDF_WriteTextTable
I'm going to have to do some more testing before I put this in the next release, but the above patch should get you going again.
Best regards,
Jan Schenkel.