Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quickly set cell styles. #1412

Closed
2 tasks
HuPengCheng1994 opened this issue Jun 13, 2018 · 0 comments
Closed
2 tasks

Quickly set cell styles. #1412

HuPengCheng1994 opened this issue Jun 13, 2018 · 0 comments

Comments

@HuPengCheng1994
Copy link

This is:

Expected Behavior

Quickly set cell styles.
It may not be perfect. I am a newbie and hope to help everyone.

How to Reproduce

<?php
/**
 * set cellStyle
 * @param integer $x Number of columns spanned 0-no columns spanned
 * @param integer $y background 0-No background 1-gray 2-blue 3-red 4-blue 5-Dark gray
 * @param integer $z restart or continue 0-no vMerge 1-restart 2-continue
 * @param integer $q boderWidth  default-10 0 no boderWidth
 */
function setTable($x=0,$y=0,$z=0,$q=10)
{

	if($x == 0 && $y == 0 && $z == 0 && $q == 0) {
		return $tableStyle = ['valign' => 'center',];

	} else if($x == 0 && $y == 0 && $z == 0 ) {
	return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center'];

	} else if($x == 0 && $y == 4 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => 'yellow'];

	}else if($x == 0 && $y == 5 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => '#BFBFBF'];

	} else if($x == 0 && $y == 3 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => 'red'];

	} else if($x == 0 && $y == 2 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => '#9cc2e5'];

	}else if($x == 0 && $y == 1 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => '#EEECE1'];

	} else if($x > 0 && $y == 0 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','gridSpan' => $x];

	} else if($x > 0 && $y == 2 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => '#9cc2e5','gridSpan' => $x];

	}else if($x > 0 && $y == 5 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => '#BFBFBF','gridSpan' => $x];

	}else if($x > 0 && $y == 1 && $z == 0) {
		return $tableStyle = ['borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => '#EEECE1','gridSpan' => $x];

	} else if($x == 0 && $y == 0 && $z== 1 ) {
		return $tableStyle = ['vMerge' => 'restart','borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center'];

	} else if($x == 0 && $y == 1 && $z== 1 ) {
		return $tableStyle = ['vMerge' => 'restart','borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center','bgColor' => '#EEECE1'];

	} else if($x == 0 && $y == 0 && $z== 2 ) {
		return $tableStyle = ['vMerge' => 'continue','borderTopSize' => $q, 'borderBottomSize' => $q, 'borderLeftSize' => $q, 'borderRightSize' => $q, 'valign' => 'center',];
	}

Context

  • PHP version:
  • PHPWord version: 0.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant