导出为 PDF 时的边框问题



版本:

PHP 版本: 7.0.8

拉拉维尔版本:5.6

软件包版本:2.1.0

描述:

嗨,我们尝试使用拉拉维尔-Excel导出pdf文件功能通过tcpdf, 但得到边界问题是不同的。

你能教我们如何解决这个问题吗

我使用的是tcpdf,也尝试使用dompdf,但不能在php 7.1或更高版本上运行。

以下是我的代码:

公共函数导出任务列表(请求$request,作业$job( {

$pathToFile = storage_path('app/xls/task.xlsx'); // find the xltx file
Excel::load($pathToFile, function ($doc) use ($job) {
$tasks = Task::where('job_id', $job->id)
->orderBy('created_at', 'DESC')
->get();
$Company = Company::where('id', $job->company_id)->first();

$sheet = $doc->setActiveSheetIndex(0);  // access to sheet 1

$sheet->setCellValue('C4', $job->JobNo);
$sheet->setCellValue('C5', $job->JobName);
$sheet->setCellValue('L4', $Company->CompanyName);
$sheet->setCellValue('L5', $Company->CompanyChineseName);
$sheet->getStyle('L5')->getFont()->setName('msungstdlight');
$sheet->setCellValue('P4', $job->JobTranslationDirection);
$sheet->setCellValue('P5', $job->JobTranslationTeam);
$sheet->setCellValue('R5', $job->JobSales);

$styleArray2 = array(
'borders' => array(
'top' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
),'bottom' => array(
'style' => PHPExcel_Style_Border::BORDER_NONE,
),'left' => array(
'style' => PHPExcel_Style_Border::BORDER_NONE,
),'right' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN,
),
),
);
$sheet->getStyle('A7')->applyFromArray($styleArray2)
}
})->export('pdf');

最新更新