Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multicell() Draws border over previous cell #37

Closed
mcarpenterjr opened this issue May 17, 2018 · 2 comments
Closed

Multicell() Draws border over previous cell #37

mcarpenterjr opened this issue May 17, 2018 · 2 comments

Comments

@mcarpenterjr
Copy link

I have a question out on stack overflow,
That pertains to multicell() and borders, where would the best place to get answers to questions like this? is it here, StackOverflow, somewhere else?

Any help/direction much appreciated.

@mcarpenterjr
Copy link
Author

I have this block that creates a set of TCPDF MultiCell()s in a multicolumn pdf.

$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', '', 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', '', 1, '', '', true, 0, false, false, '', 'M', false);
  • The first line uses TCPDF's native function to get the height of the multi line string and sets the $mbh variable to later set both cells to the same height.
  • The $DColW0 and $TColW0 variables are predetermined and set column widths.

My problem is the result looks like this,

TCPDF Multiline Issue

I tried using the title column's width in the x value of the data cell, but that just shifts the content out of the column.

The content looks to be in the right place the border for the data cell is just drawn in the wrong spot. Is there a setting or something I'm missing when it comes to MultiCell() borders? Any help/suggestions much appreciated.


Updating the block to make use of SetX

$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', '', 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->SetX($TColW0);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', '', 1, '', '', true, 0, false, false, '', 'M', false);

Shifts the content independent of where the border is drawn.
SETX Example


Using the x specification inside of MultiCell()

$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', '', 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', '', 1, $TColW0, '', true, 0, false, false, '', 'M', false);

enter image description here

Again content shifts, border is drawn over previous cell.

MultiCell() Documentation.


Result with cell fill turned on.

$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', 1, 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', 1, 1, '', '', true, 0, false, false, '', 'M', false);

FillExample

Turning fill on paints over all previously drawn borders for that row with the exception of the border for the last cell. The content of both cells is still in the expected position, the border is drawn to the expected size, but is drawn in the wrong position.

@mcarpenterjr mcarpenterjr changed the title Best place to get help? Multicell() Draws border over previous cell May 22, 2018
@nicolaasuni
Copy link
Member

Please report this to:
https://github.com/tecnickcom/TCPDF/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants