0
2行目と3行目の間に3行の空白(空白行のような)を含むフッターがあります。 3は太字と通常のテキストを含んでいますが、私はそれをテキストランとして実装する必要があります。 しかし、1行目と2行目の間に改行があるはずです。そのため、これらの両方にaddTextを使用します。
次のように残念ながら、フッターコンテンツが表示される順序は次のとおりです。
textrun
footerText1
footerText2
textrunが最初に処理し、上記表示されます他の行!
注文を正しく取得するにはどうすればよいですか?
私のフッターのコードは次のとおりです。
// create footer
$footer = $section->addFooter();
// textrun declaration removed from here
// create footer content
$footerText1 = "Blah blah blah.";
$footerText2 = "Ipsum loret Ipsum loret Ipsum loret.";
// define font styles
$smallFontStyleName = 'smallText';
$phpWord->addFontStyle($smallFontStyleName, array(
'name' => 'Helvetica',
'size' => 8,
));
$boldSmallFontStyleName = 'BoldSmallText';
$phpWord->addFontStyle($boldSmallFontStyleName, array(
'bold' => true,
'name' => 'Helvetica',
'size' => 8,
));
// define paragraph spacing styles
$phpWord->addParagraphStyle('line1FooterStyle', array('spaceAfter'=>20));
$phpWord->addParagraphStyle('line2FooterStyle', array('spaceAfter'=>380));
// add content
$footer->addText($footerText1,
array('name' => 'Helvetica', 'size' => 8),
array('space' => array('after' => 20))
);
$footer->addText($footerText2,
array('name' => 'Helvetica', 'size' => 8),
array('space' => array('after' => 380))
);
//ここ
$textrun = $footer->addTextRun();
$textrun->addText('T', $boldSmallFontStyleName);
$textrun->addText(' ++353 1 555 0001 ', $smallFontStyleName);
$textrun->addText('E', $boldSmallFontStyleName);
$textrun->addText(' [email protected] ', $smallFontStyleName);
$textrun->addText('W', $boldSmallFontStyleName);
$textrun->addText(' abcd.ie/wxz', $smallFontStyleName);
オプションはおそらく 'addFooter()'を使って削除し、フッタ全体をtextrunとして実装します。 –
しかし、私は1行目と2行目の後に改行が必要です。私は複数のテキストランを試し、それがどうなるか見てみましょう。 – Benjamin
OK、問題を見て固定しました。私は$ footer-> addText行の前にtextrunを宣言していました。つまり、テキストランコードが最初に正しく挿入されたことを意味します。 D'oh! – Benjamin