简体   繁体   English

导出为pdf时出现边界问题

[英]border issue when export to pdf

Versions: 版本:

PHP version: 7.0.8 PHP版本:7.0.8

Laravel version: 5.6 Laravel版本:5.6

Package version: 2.1.0 套件版本:2.1.0

Description: 描述:

Hi, We have tried to use Laravel-Excel export pdf file function by tcpdf, but got the issue of the border was different. 嗨,我们尝试通过tcpdf使用Laravel-Excel导出pdf文件功能,但是得到的边框问题有所不同。

Would you teach us how to fix this issue 您会教我们如何解决此问题

I am used tcpdf and also had try to use the dompdf but not work on php 7.1 or higher. 我曾经使用过tcpdf,也曾尝试使用dompdf,但不适用于php 7.1或更高版本。

the following was my code: 以下是我的代码:

public function exporttasklist(Request $request, Job $job) { 公共功能exporttasklist(请求$ 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');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM