내가 공백이없는 매우 긴 텍스트와 테이블이DOMPDF 테이블 고정 열 너비 및 휴식 긴 텍스트
가 그럼 난 word-break:break-all;
및 word-wrap:break-word;
설정 (사용자는 모든 매개 변수와 함께 완전한 전체 웹 사이트의 URL을 게시하고자) 텍스트가 테이블에 맞을 수 있기를 희망하는 각 <td>
.
또한 모든 <td>
/열 너비를 지정된 양으로 설정합니다.
사례 1 : 없음 table-layout: fixed
<table class="bordered">
<tr class="font-12">
<th style="width: 25px">No</th>
<th style="width: 100px">Nama Alat</th>
<th style="width: 25px">Jml</th>
<th style="width: 300px">Spesifikasi</th>
<th style="width: 300px">Supplier</th>
<th style="width: 150px">Gambar</th>
</tr>
@foreach ($items as $index => $item)
<tr>
<td style="width: 25px">{{ ($index+1) }}</td>
<td style="width: 100px">{{ $item['name'] }}</td>
<td style="width: 25px">{{ $item['jumlah_disetujui'] }}</td>
<td class="font-12" style="width: 300px; word-break:break-all; word-wrap:break-word;">
{!! nl2br($item['spesifikasi']) !!}
</td>
<td class="font-12" style="width: 300px; word-break:break-all; word-wrap:break-word;">
{!! nl2br($item['supplier']) !!}
</td>
<td style="width: 150px">
@if ($item['image'])
<img style="max-height: 125px;" src="{{ $item['image'] }}" />
@else
-
@endif
</td>
</tr>
@endforeach
</table>
사례 1 PDF 결과는 : 바꿈이 작동하지 않습니다, 열 너비의 작품을 텍스트가 거의없는 셀에는 있지만 긴 텍스트가있는 셀에서는 작동하지 않습니다 (단어 랩이 필요함).
사례 2 :가 추가 table-layout: fixed
<table class="bordered" style="table-layout: fixed"> <!-- only added this -->
<tr class="font-12">
<th style="width: 25px">No</th>
<th style="width: 100px">Nama Alat</th>
<th style="width: 25px">Jml</th>
<th style="width: 300px">Spesifikasi</th>
<th style="width: 300px">Supplier</th>
<th style="width: 150px">Gambar</th>
</tr>
@foreach ($items as $index => $item)
<tr>
<td style="width: 25px">{{ ($index+1) }}</td>
<td style="width: 100px">{{ $item['name'] }}</td>
<td style="width: 25px">{{ $item['jumlah_disetujui'] }}</td>
<td class="font-12" style="width: 300px; word-break:break-all; word-wrap:break-word;">
{!! nl2br($item['spesifikasi']) !!}
</td>
<td class="font-12" style="width: 300px; word-break:break-all; word-wrap:break-word;">
{!! nl2br($item['supplier']) !!}
</td>
<td style="width: 150px">
@if ($item['image'])
<img style="max-height: 125px;" src="{{ $item['image'] }}" />
@else
-
@endif
</td>
</tr>
@endforeach
</table>
사례 2 PDF 결과 : 워드 랩 작동하지만 열 너비는 효과가 없습니다
내가 원하는 것은 : 작업이 고정 너비 열이있는 테이블
DOMPDF에 할이 불가능인가 단어 - 포장?
이를 해결하는 데 도움이되는 해결 방법이나 '해킹'이 있습니까?
다른/더 나은 PDF 생성기를 찾기 시작해야할까요?
편집 : 나는 또한 고정되는 버그의 흔적과 함께,이에 Github에서 문제를 많이 발견
- Table cell width is not honored if content exceeds the specified dimensions #1017
- Table widths do not conform to css width attribute. #1253
- Fixed table layout ignored column widths #1432