|
17 | 17 |
|
18 | 18 | namespace PhpOffice\PhpWord\Writer\Word2007\Style; |
19 | 19 |
|
| 20 | +use PhpOffice\PhpWord\ComplexType\TblWidth as TblWidthComplexType; |
| 21 | +use PhpOffice\PhpWord\SimpleType\TblWidth; |
20 | 22 | use PhpOffice\PhpWord\Style\Table; |
21 | 23 | use PhpOffice\PhpWord\Style\TablePosition; |
22 | 24 | use PhpOffice\PhpWord\TestHelperDOCX; |
@@ -75,7 +77,7 @@ public function testCellSpacing() |
75 | 77 | $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblCellSpacing'; |
76 | 78 | $this->assertTrue($doc->elementExists($path)); |
77 | 79 | $this->assertEquals(10.3, $doc->getElementAttribute($path, 'w:w')); |
78 | | - $this->assertEquals(\PhpOffice\PhpWord\SimpleType\TblWidth::TWIP, $doc->getElementAttribute($path, 'w:type')); |
| 80 | + $this->assertEquals(TblWidth::TWIP, $doc->getElementAttribute($path, 'w:type')); |
79 | 81 | } |
80 | 82 |
|
81 | 83 | /** |
@@ -118,4 +120,25 @@ public function testTablePosition() |
118 | 120 | $this->assertEquals(TablePosition::YALIGN_TOP, $doc->getElementAttribute($path, 'w:tblpYSpec')); |
119 | 121 | $this->assertEquals(60, $doc->getElementAttribute($path, 'w:tblpY')); |
120 | 122 | } |
| 123 | + |
| 124 | + public function testIndent() |
| 125 | + { |
| 126 | + $type = TblWidth::TWIP; |
| 127 | + $value = 100; |
| 128 | + |
| 129 | + $tableStyle = new Table(); |
| 130 | + $tableStyle->setIndent(new TblWidthComplexType($type, $value)); |
| 131 | + |
| 132 | + $phpWord = new \PhpOffice\PhpWord\PhpWord(); |
| 133 | + $section = $phpWord->addSection(); |
| 134 | + $table = $section->addTable($tableStyle); |
| 135 | + $table->addRow(); |
| 136 | + |
| 137 | + $doc = TestHelperDOCX::getDocument($phpWord, 'Word2007'); |
| 138 | + |
| 139 | + $path = '/w:document/w:body/w:tbl/w:tblPr/w:tblInd'; |
| 140 | + $this->assertTrue($doc->elementExists($path)); |
| 141 | + $this->assertSame($value, (int) $doc->getElementAttribute($path, 'w:w')); |
| 142 | + $this->assertSame($type, $doc->getElementAttribute($path, 'w:type')); |
| 143 | + } |
121 | 144 | } |
0 commit comments