2017-07-16 3 views
1

私はpdfのgridviewを印刷しています。グリッドビューは問題ありません。しかし、細胞は正しく充填されていません。私は少しフォントを減らすことができると思う、セルが適切に入力されます。私は幅を減らしました。しかし、細胞は歪んでいる。 GridViewののyii2でGridviewのフォントサイズを指定

コード -

<?= GridView::widget([ 
     'dataProvider' => $dataProvider1, 
     //'filterModel' => $searchModel, 
     'layout'=>"{items}", 
     'columns' => [ 
      ['class' => 'yii\grid\SerialColumn'], 
      'hsncode', 
      [ 
       'label' => 'Productname', 
       'attribute' =>'productname', 
       'headerOptions' => ['style' => 'width:20%'], 
       //'contentOptions' => ['class' => 'col-lg-1'], 
       //'format'=>['decimal',2] 
      ], 
      'batchno', 
      //'expdate', 
      [ 
       'attribute'=>'expdate', 
       'format'=>['DateTime','php:m-y'], 
       'headerOptions' => ['style' => 'width:6%'], 
      ], 
      'mrp', 
      'rate', 

      'qty', 
      'free',   
      'discount', 
      [ 
       'label' => 'Value', 
       'attribute' =>'value', 
       //'contentOptions' => ['class' => 'col-lg-1'], 
       'format'=>['decimal',2] 
      ], 
      [ 
       'label' => 'GST%', 
       'attribute' =>'gstpercent', 
       //'headerOptions' => ['style' => 'width:6%'], 
       //'contentOptions' => ['class' => 'col-lg-1'], 
       'format'=>['decimal',0] 
      ], 


      [ 
       'label' => 'Total', 
       'attribute' =>'totalamount', 
       'headerOptions' => ['style' => 'width:9%'], 
       //'contentOptions' => ['class' => 'col-lg-1'], 
       'format'=>['decimal',2] 
      ], 
     ], 
     ]); ?> 

GridViewのように見える - enter image description here

私はGridViewの中でフォントを指定する方法を教えてください。

答えて

1

あなたはグリッドコンテナ列微細加工

<?= GridView::widget([ 
     'dataProvider' => $dataProvider1, 
     //'filterModel' => $searchModel, 
     'layout'=>"{items}", 
     'options' => ['style' => 'font-size:12px;'] 
     'columns' => [ 
      [ 
       'label' => 'your_label', 
       'attribute' =>'your_attribute', 
       'contentOptions' => ['style' => 'font-size:12px;'] 
      ] 
+0

<?= GridView::widget([ 'dataProvider' => $dataProvider1, //'filterModel' => $searchModel, 'layout'=>"{items}", 'options' => ['style' => 'font-size:12px;'] 'columns' => [ 

または直接のオプションを使用することができます。どうもありがとう。 – Tanmay

関連する問題