如何在fpdf中调整单元格对齐

时间:2017-02-21 04:37:12

标签: php fpdf

我使用了fpdf的WordWrap函数,但由于这一点,细胞对齐变得扭曲。 正在添加额外的空白列,其他单元格也会受到影响。 这是代码。提前谢谢。

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="app">
    <div  ng-controller="mainController">
    <label>Search: <input ng-model="searchText"></label>
        <h2>Course Type</h2>
        <label>Public</label>
        <input type="checkbox" ng-model="Filter.courseType.public" ng-true-value="public"  ng-false-value="!public" />&nbsp;
        <label>Private</label>
        <input type="checkbox" ng-model="Filter.courseType.private" ng-true-value="private"  ng-false-value="!private" />&nbsp;
        <label>Military</label>
        <input type="checkbox" ng-model="Filter.courseType.military" ng-true-value="military"  ng-false-value="!military" />&nbsp;
        <hr />
        <h2>Region</h2>
        <label>Northern</label>
        <input  type="checkbox" ng-model="Filter.region.northern" ng-true-value="northern"  ng-false-value="!northern" />&nbsp;
        <label>Southern</label>
        <input  type="checkbox" ng-model="Filter.region.southern" ng-true-value="southern"  ng-false-value="!southern" />
        <hr />
        <h2>Results:</h2>
        <table width="100%" cellpadding="5">
          <thead>
            <tr style="text-align:left">
                <th ng-click="OrderFilter='name'">Name</th>
                <th ng-click="OrderFilter='courseType'">Course Type</th>
                <th ng-click="OrderFilter='region'">Region</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="course in courses | filter:searchText | searchFilter:Filter.name | searchFilter:Filter.courseType | searchFilter:Filter.region | orderBy:OrderFilter">
                <td>{{course.name}}</td>
                <td>{{course.courseType}}</td>
                <td>{{course.region}}</td>
            </tr>
          </tbody>
        </table>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

试试这个

$str = "An example of a long word is: Supercalifragulistic"
$wrapped = wordwrap($str,15)
$pdf->Cell(50,7,$wrapped,1);
$pdf->Write("<br>");

  1. Word wrap
  2. Write HTML