- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在这里要做的就是让我的 B16 单元格与顶部对齐。我为此编写了一些代码,但由于某种原因,当我在 Excel 中打开它时,它与底部对齐,但仍有人知道这是为什么?我在我的 //Set Up
中设置了这个区域。
//Excel Transfer
$myFile=fopen("DATA/BI_spo.txt","r") or exit("Can't open file!");
$spo = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/BI_cont.txt","r") or exit("Can't open file!");
$cont = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/BI_site.txt","r") or exit("Can't open file!");
$site = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/BI_job.txt","r") or exit("Can't open file!");
$job = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/Ob_des.txt","r") or exit("Can't open file!");
$des1 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/Ob_act.txt","r") or exit("Can't open file!");
$act1 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/Ob_date.txt","r") or exit("Can't open file!");
$date1 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GP_des.txt","r") or exit("Can't open file!");
$des2 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GP_act.txt","r") or exit("Can't open file!");
$act2 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GP_date.txt","r") or exit("Can't open file!");
$date2 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/FGR_des.txt","r") or exit("Can't open file!");
$des3 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/FGR_act.txt","r") or exit("Can't open file!");
$act3 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/FGR_date.txt","r") or exit("Can't open file!");
$date3 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP1_Radio1.txt","r") or exit("Can't open file!");
$P1Radio1 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP1_Radio2.txt","r") or exit("Can't open file!");
$P1Radio2 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP1_Radio3.txt","r") or exit("Can't open file!");
$P1Radio3 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP1_Radio4.txt","r") or exit("Can't open file!");
$P1Radio4 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP1_Radio5.txt","r") or exit("Can't open file!");
$P1Radio5 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP2_Radio1.txt","r") or exit("Can't open file!");
$P2Radio1 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP2_Radio2.txt","r") or exit("Can't open file!");
$P2Radio2 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP2_Radio3.txt","r") or exit("Can't open file!");
$P2Radio3 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP2_Radio4.txt","r") or exit("Can't open file!");
$P2Radio4 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP2_Radio5.txt","r") or exit("Can't open file!");
$P2Radio5 = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/GIP3_add.txt","r") or exit("Can't open file!");
$add = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/CB_name.txt","r") or exit("Can't open file!");
$name = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/CB_title.txt","r") or exit("Can't open file!");
$title = fgets($myFile);
fclose($myFile);
$myFile=fopen("DATA/CB_date.txt","r") or exit("Can't open file!");
$date = fgets($myFile);
fclose($myFile);
Include_once 'PHP/PHPExcel.php';
$objPHPExcel = new PHPExcel();
$activeSheet = $objPHPExcel->getActiveSheet();
$objPHPExcel->getActiveSheet()->setTitle('Senior Managers Site Tour');
$objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(5);
$styleArray = array(
'borders' => array(
'allborders' => array(
'style' => PHPExcel_Style_Border::BORDER_THIN
)
)
);
//Set Up
$activeSheet->setCellValue('E1','Senior Managers Site Tour');
$objPHPExcel->getActiveSheet()->getStyle('A1:N70')->applyFromArray($styleArray);
$objPHPExcel->getActiveSheet()->mergeCells('A1:A70');
$objPHPExcel->getActiveSheet()->mergeCells('N1:N70');
$styleVerticalAlign = array(
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::VERTICAL_TOP,
)
);
$objPHPExcel->getActiveSheet()->getStyle('B13')->applyFromArray($styleVerticalAlign);
//Logo & Title
$objPHPExcel->getActiveSheet()->mergeCells('B1:D4');
$objPHPExcel->getActiveSheet()->mergeCells('E1:M4');
$objPHPExcel->getActiveSheet()->mergeCells('B5:M5');
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('Murphys Logo');
$objDrawing->setPath('IMAGES/LogoExcel.png');
$objDrawing->setCoordinates('B1');
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$titleArray = array(
'font' => array(
'bold' => true,
'size' => 32,
));
$styleTitleAlign = array(
'alignment' => array(
'horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
)
);
$objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray($titleArray);
$objPHPExcel->getActiveSheet()->getStyle('E1')->applyFromArray($styleTitleAlign);
//Basic Information
$objPHPExcel->getActiveSheet()->mergeCells('B6:D6');
$objPHPExcel->getActiveSheet()->mergeCells('E6:G6');
$objPHPExcel->getActiveSheet()->mergeCells('H6:J6');
$objPHPExcel->getActiveSheet()->mergeCells('K6:M6');
$objPHPExcel->getActiveSheet()->mergeCells('B7:D7');
$objPHPExcel->getActiveSheet()->mergeCells('E7:M7');
$objPHPExcel->getActiveSheet()->mergeCells('B8:D8');
$objPHPExcel->getActiveSheet()->mergeCells('E8:M8');
$objPHPExcel->getActiveSheet()->mergeCells('B9:M10');
$activeSheet->setCellValue('B6','Site / Project / Object:');
$activeSheet->setCellValue('E6',$spo);
$activeSheet->setCellValue('H6','Contract Number:');
$activeSheet->setCellValue('K6',$cont);
$activeSheet->setCellValue('B7','Site Manager:');
$activeSheet->setCellValue('E7',$site);
$activeSheet->setCellValue('B8','Job / Task Description:');
$activeSheet->setCellValue('E8',$job);
//Observation
$objPHPExcel->getActiveSheet()->mergeCells('B11:M11');
$objPHPExcel->getActiveSheet()->mergeCells('B12:E12');
$objPHPExcel->getActiveSheet()->mergeCells('F12:I12');
$objPHPExcel->getActiveSheet()->mergeCells('J12:M12');
$objPHPExcel->getActiveSheet()->mergeCells('B13:E17');
$objPHPExcel->getActiveSheet()->mergeCells('F13:I17');
$objPHPExcel->getActiveSheet()->mergeCells('J13:M17');
$objPHPExcel->getActiveSheet()->mergeCells('B18:M19');
$activeSheet->setCellValue('B11','OBSERVATION (areas where improvement can be made).');
$activeSheet->setCellValue('B12','Breif Description:');
$activeSheet->setCellValue('B13',$des1);
$activeSheet->setCellValue('F12','Agreed Action:');
$activeSheet->setCellValue('F13',$act1);
$activeSheet->setCellValue('J12','Close Date:');
$activeSheet->setCellValue('J13',$date1);
$objPHPExcel->getActiveSheet()->getStyle('B11')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
//Good Practices
$objPHPExcel->getActiveSheet()->mergeCells('B20:M20');
$objPHPExcel->getActiveSheet()->mergeCells('B21:E21');
$objPHPExcel->getActiveSheet()->mergeCells('F21:I21');
$objPHPExcel->getActiveSheet()->mergeCells('J21:M21');
$objPHPExcel->getActiveSheet()->mergeCells('B22:E26');
$objPHPExcel->getActiveSheet()->mergeCells('F22:I26');
$objPHPExcel->getActiveSheet()->mergeCells('J22:M26');
$objPHPExcel->getActiveSheet()->mergeCells('B27:M28');
$activeSheet->setCellValue('B20','GOOD PRACTICES (Commendable acts and actions, Improvements, Innovations etc).');
$activeSheet->setCellValue('B21','Breif Description:');
$activeSheet->setCellValue('B22',$des2);
$activeSheet->setCellValue('F21','Agreed Action:');
$activeSheet->setCellValue('F22',$act2);
$activeSheet->setCellValue('J21','Close Date:');
$activeSheet->setCellValue('J22',$date2);
$objPHPExcel->getActiveSheet()->getStyle('B20')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
//Feedback Given & Received
$objPHPExcel->getActiveSheet()->mergeCells('B29:M29');
$objPHPExcel->getActiveSheet()->mergeCells('B30:E30');
$objPHPExcel->getActiveSheet()->mergeCells('F30:I30');
$objPHPExcel->getActiveSheet()->mergeCells('J30:M30');
$objPHPExcel->getActiveSheet()->mergeCells('B31:E35');
$objPHPExcel->getActiveSheet()->mergeCells('F31:I35');
$objPHPExcel->getActiveSheet()->mergeCells('J31:M35');
$objPHPExcel->getActiveSheet()->mergeCells('B36:M37');
$activeSheet->setCellValue('B29','FEEDBACK GIVEN & RECEIVED');
$activeSheet->setCellValue('B30','Breif Description:');
$activeSheet->setCellValue('B31',$des3);
$activeSheet->setCellValue('F30','Agreed Action:');
$activeSheet->setCellValue('F31',$act3);
$activeSheet->setCellValue('J30','Close Date:');
$activeSheet->setCellValue('J31',$date3);
$objPHPExcel->getActiveSheet()->getStyle('B29')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
//General Impression
$objPHPExcel->getActiveSheet()->mergeCells('B38:M38');
$objPHPExcel->getActiveSheet()->mergeCells('B39:G39');
$objPHPExcel->getActiveSheet()->mergeCells('H39:M39');
$objPHPExcel->getActiveSheet()->mergeCells('B40:G40');
$objPHPExcel->getActiveSheet()->mergeCells('H40:M40');
$objPHPExcel->getActiveSheet()->mergeCells('B41:M41');
$objPHPExcel->getActiveSheet()->mergeCells('B42:K42');
$objPHPExcel->getActiveSheet()->mergeCells('L42:M42');
$objPHPExcel->getActiveSheet()->mergeCells('B43:K43');
$objPHPExcel->getActiveSheet()->mergeCells('L43:M43');
$objPHPExcel->getActiveSheet()->mergeCells('B44:K44');
$objPHPExcel->getActiveSheet()->mergeCells('L44:M44');
$objPHPExcel->getActiveSheet()->mergeCells('B45:K45');
$objPHPExcel->getActiveSheet()->mergeCells('L45:M45');
$objPHPExcel->getActiveSheet()->mergeCells('B46:K46');
$objPHPExcel->getActiveSheet()->mergeCells('L46:M46');
$objPHPExcel->getActiveSheet()->mergeCells('B47:M47');
$objPHPExcel->getActiveSheet()->mergeCells('B48:K48');
$objPHPExcel->getActiveSheet()->mergeCells('L48:M48');
$objPHPExcel->getActiveSheet()->mergeCells('B49:K49');
$objPHPExcel->getActiveSheet()->mergeCells('L49:M49');
$objPHPExcel->getActiveSheet()->mergeCells('B50:K50');
$objPHPExcel->getActiveSheet()->mergeCells('L50:M50');
$objPHPExcel->getActiveSheet()->mergeCells('B51:K51');
$objPHPExcel->getActiveSheet()->mergeCells('L51:M51');
$objPHPExcel->getActiveSheet()->mergeCells('B52:K52');
$objPHPExcel->getActiveSheet()->mergeCells('L52:M52');
$objPHPExcel->getActiveSheet()->mergeCells('B53:M54');
$activeSheet->setCellValue('B38','GENERAL IMPRESSION');
$activeSheet->setCellValue('B39','1 = No evidence / poor / no understanding');
$activeSheet->setCellValue('H39','2 = Some evidence / understanding / not consistent');
$activeSheet->setCellValue('B40','3 = Requirements in place / basic unerstanding');
$activeSheet->setCellValue('H40','4 = Detailed understanding / more than minimum standards');
$objPHPExcel->getActiveSheet()->getStyle('B38')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
$activeSheet->setCellValue('B41','CULTURE');
$activeSheet->setCellValue('B42','Is the CDP obvious - You Said / We Did Boards; Feedback Stations; Posters?:');
$activeSheet->setCellValue('L42',$P1Radio1);
$activeSheet->setCellValue('B43','Are there any Speak Up Coaches on this site?');
$activeSheet->setCellValue('L43',$P1Radio2);
$activeSheet->setCellValue('B44','Are Focus Leader meetings happening?:');
$activeSheet->setCellValue('L44',$P1Radio3);
$activeSheet->setCellValue('B45','Mention the Mental Tools, do people understand them?:');
$activeSheet->setCellValue('L45',$P1Radio4);
$activeSheet->setCellValue('B46','Ask what "Never Harm" means to the teams:');
$activeSheet->setCellValue('L46',$P1Radio5);
$objPHPExcel->getActiveSheet()->getStyle('B41')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
$activeSheet->setCellValue('B47','SYSTEM');
$activeSheet->setCellValue('B48','Are first impressions good, site signage, induction etc?:');
$activeSheet->setCellValue('L48',$P2Radio1);
$activeSheet->setCellValue('B49','Is the site tidy, well laid out etc?:');
$activeSheet->setCellValue('L49',$P2Radio2);
$activeSheet->setCellValue('B50','Are morning briefings / daily risk assessment carried out?:');
$activeSheet->setCellValue('L50',$P2Radio3);
$activeSheet->setCellValue('B51','Have all the team been briefed & signed onto the RAMS?:');
$activeSheet->setCellValue('L51',$P2Radio4);
$activeSheet->setCellValue('B52','Ask what they would do if there was a change in the work activity i.e. not in RAMS?:');
$activeSheet->setCellValue('L52',$P2Radio5);
$objPHPExcel->getActiveSheet()->getStyle('B47')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
//Comments
$objPHPExcel->getActiveSheet()->mergeCells('B55:M55');
$objPHPExcel->getActiveSheet()->mergeCells('B56:M63');
$objPHPExcel->getActiveSheet()->mergeCells('B64:M65');
$activeSheet->setCellValue('B55','Additional Comments:');
$activeSheet->setCellValue('B56',$add);
$objPHPExcel->getActiveSheet()->getStyle('B55')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
//Completed By
$objPHPExcel->getActiveSheet()->mergeCells('B66:M66');
$objPHPExcel->getActiveSheet()->mergeCells('B67:C67');
$objPHPExcel->getActiveSheet()->mergeCells('D67:G67');
$objPHPExcel->getActiveSheet()->mergeCells('H67:I67');
$objPHPExcel->getActiveSheet()->mergeCells('J67:M67');
$objPHPExcel->getActiveSheet()->mergeCells('B68:C68');
$objPHPExcel->getActiveSheet()->mergeCells('D68:G68');
$objPHPExcel->getActiveSheet()->mergeCells('H68:M68');
$objPHPExcel->getActiveSheet()->mergeCells('B69:M70');
$activeSheet->setCellValue('B66','COMPLETED BY');
$activeSheet->setCellValue('B67','Name:');
$activeSheet->setCellValue('D67',$name);
$activeSheet->setCellValue('H67','Title:');
$activeSheet->setCellValue('J67',$title);
$activeSheet->setCellValue('B68','Date:');
$activeSheet->setCellValue('BD68',$date);
$objPHPExcel->getActiveSheet()->getStyle('B66')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getStartColor()->setRGB('D6D6D6');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('Senior Managers Site Tour.xls');
最佳答案
尝试这个:
$objPHPExcel->getActiveSheet()->getStyle('B13')
->getAlignment()->setVertical(PHPExcel_Style_Alignment::VERTICAL_TOP);
关于php - Excel PHP垂直对齐不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36236020/
我希望能够像在 jsFiddle 中那样将元素列表对齐到右侧的复选框。这是如何做到这一点的最佳实践?传统上我从来没有 float 过相互嵌套的元素,所以我想确定这是否是解决此问题的正确方法。 代码(h
指令.align n是什么意思在数组中做什么? 更具体地说,假设我有以下部分代码: array: .align 2 .space 800 它的重要性是什么,为什么不跳过它并使用
基本上我正在寻找一种强制特定相对对齐的方法 即我想保证其他一些值(value) m s.t m > n alignment_of(foo) % 2^m == 2^n IE: .align 2^m; .
在我的代码中,我必须考虑一个数组数组,其中内部数组具有固定维度。为了使用 STL 算法,将数据实际存储为数组的数组很有用,但我还需要将该数据传递给 C 库,该库采用扁平化的 C 样式数组。 如果能够以
横向上,我想显示两个位图,并在它们之间显示一个标签字段。 代码看起来很简单,但所有字段都添加在屏幕左侧。 HorizontalFieldManager hfm = new HorizontalFiel
我想绘制一个变量名称及其符号。因为某些变量的名称很长,所以我试图将换行符与轴标签混合使用。这会导致对齐中发生有趣的事情: par(mar=c(1,12,1,1)) plot( y=1:6, 1:6,
使用这个脚本 df <- data.frame(x = 1:5, y = 1:5, color = letters[1:5]) ggplot(df, aes(x, y, fill = color))
我有一个带有标量字段的结构,比如妈妈,我想在屏幕上对齐的列中显示结构的值,可能还有一些标题。这是一个最小的工作示例: mom.a = 1; mom.b = 2; mom.veryLongName =
在 iOS6 中,我使用自动布局。 我有 2 个以编程方式创建的 View v1 和 v2。 v2 作为 subview 添加到 v1 v1 的约束已通过编程方式创建(此处未显示)。 我希望 v1 和
概述 浏览时operator new, operator new[] - cppreference.com ,似乎我们有许多选项来分配具有特定对齐要求的对象数组。但是,没有指定如何使用它们,而且我似乎
Widget _createProfileContainer() { return new Container( height: 64.0, child: ne
我正在使用 Bootstrap 和语义 UI 的组合来设计和对齐我的网页。目前,我在将页面 api map 和博客文章在整个页面上对齐时遇到问题,而不是像图像所示 那样堆叠在一起。 这是我的底层代码,
所以我已经添加了标签和所有内容,但我仍然在格式化和对齐所有内容时遇到问题。计算按钮显然应该居中。我知道使用 gridbag 将框架分割成坐标系,当一列大于其他列时,它会调整其他列并将其抛弃(对吗?)。
我必须将程序上的按钮对齐到中间,我运行的当前代码但显示的按钮与程序一样大,我想要一个特定大小的中心按钮,这是我尝试过的 /** * Created by Timk9 on 11/04/2016.
我正在尝试将 VIM 作为我的 ruby/rails 编辑器。太胖了,我对它的功能印象深刻 并且我能够安装以下插件以提供更好的 IDE 体验 自动配对 Better-snipmate-snippe
在结构内对齐成员的最佳或常规方法是什么?添加虚拟数组是最佳解决方案吗? 我有一个 double 的结构和 double 的三倍是吗? struct particle{ double mass;
我正在尝试对齐我的输出,但由于某种原因我无法做到我多么想要它,这真的很令人沮丧。标题不会正确对齐。我不知道我是否正确使用了 setw()。 #include using std::cout; usi
我正在开发一个 android 应用程序,其相对布局如下所示。 这是应用程序在屏幕上的显示方式的 imgur 链接:http://imgur.com/c4rNJ .我希望“Text 1”出现在“a l
我不确定为什么我不能在下面的代码中调整按钮的位置。我有几行设置了边界,但我一定遗漏了一些东西。 public DayGUI() { mainFrame = new JF
我有一个 html 页面,我想在页面底部对齐一个 iframe,使 iframe 占据所有宽度,我无法在底部对齐 iframe。请找到底部的 iframe 标签页面。 The rest of th
我是一名优秀的程序员,十分优秀!