在yii2中指定Gridview的字体大小

在yii2中指定Gridview的字体大小,yii2,Yii2,我正在打印pdf格式的gridview。gridview很好。但是这些细胞没有正常填充。我想如果我能把字体缩小一点,单元格就会填好。我把宽度缩小了。但细胞正在被扭曲 Gridview代码- <?= GridView::widget([ 'dataProvider' => $dataProvider1, //'filterModel' => $searchModel, 'layout'=>"{items}"

我正在打印pdf格式的gridview。gridview很好。但是这些细胞没有正常填充。我想如果我能把字体缩小一点,单元格就会填好。我把宽度缩小了。但细胞正在被扭曲

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看起来像-


请告诉我如何在gridview中指定字体。

您可以使用网格容器的选项

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

工作正常。谢谢。
    <?= 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;']
            ]