PhpPresentation上下标文字展示设置

      发布在:个人笔记      评论:0 条评论
<p>PhpPresentation上下标文字展示设置可以使用字体类方法setSuperScript进行设置,具体如下代码:</p><pre style="background-color:#262e37;color:#ffffff;font-family:&#39;Consolas&#39;;font-size:11.3pt;">$textRun <span style="color:#f92672;">= </span>$shape<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">createTextRun</span>(<span style="color:#66d9ef;font-style:italic;">date</span>(<span style="color:#e6db74;">&#39;F &#39;</span>, <span style="color:#660000;">$res</span>[<span style="color:#e6db74;">&#39;mtrqf&#39;</span>]));<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setBold</span>(<span style="color:#f92672;">false</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setName</span>(<span style="color:#e6db74;">&quot;Century Gothic&quot;</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setSize</span>(<span style="color:#ae81ff;">16</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setColor</span>(<span style="color:#f92672;">new </span><span style="color:#f57dac;">Color</span>(<span style="color:#e6db74;">&#39;FF000000&#39;</span>));<br/><span style="color:#66837f;background-color:#191f26;">// &nbsp; &nbsp;$textRun = $shape-&gt;createTextRun(date(&#39;jS Y&#39;, $res[&#39;mtrqf&#39;]));</span><span style="color:#66837f;"><br/></span><span style="color:#66837f;"> &nbsp; &nbsp;</span>$textRun <span style="color:#f92672;">= </span>$shape<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">createTextRun</span>(<span style="color:#66d9ef;font-style:italic;">date</span>(<span style="color:#e6db74;">&#39;j&#39;</span>, <span style="color:#660000;">$res</span>[<span style="color:#e6db74;">&#39;mtrqf&#39;</span>]));<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setBold</span>(<span style="color:#f92672;">true</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setName</span>(<span style="color:#e6db74;">&quot;Century Gothic&quot;</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setSize</span>(<span style="color:#ae81ff;">16</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setColor</span>(<span style="color:#f92672;">new </span><span style="color:#f57dac;">Color</span>(<span style="color:#e6db74;">&#39;FF000000&#39;</span>));<br/> $textRun <span style="color:#f92672;">= </span>$shape<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">createTextRun</span>(<span style="color:#66d9ef;font-style:italic;">date</span>(<span style="color:#e6db74;">&#39;S&#39;</span>, <span style="color:#660000;">$res</span>[<span style="color:#e6db74;">&#39;mtrqf&#39;</span>]));<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setBold</span>(<span style="color:#f92672;">true</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setSuperScript</span>(<span style="color:#f92672;">true</span>);<span style="color:#66837f;background-color:#191f26;">//</span><span style="color:#66837f;background-color:#191f26;font-family:&#39;宋体&#39;;">上标</span><span style="color:#66837f;font-family:&#39;宋体&#39;;"><br/></span><span style="color:#66837f;font-family:&#39;宋体&#39;;"> &nbsp; &nbsp;</span>$textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setName</span>(<span style="color:#e6db74;">&quot;Century Gothic&quot;</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setSize</span>(<span style="color:#ae81ff;">16</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setColor</span>(<span style="color:#f92672;">new </span><span style="color:#f57dac;">Color</span>(<span style="color:#e6db74;">&#39;FF000000&#39;</span>));<br/> $textRun <span style="color:#f92672;">= </span>$shape<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">createTextRun</span>(<span style="color:#66d9ef;font-style:italic;">date</span>(<span style="color:#e6db74;">&#39; Y&#39;</span>, <span style="color:#660000;">$res</span>[<span style="color:#e6db74;">&#39;mtrqf&#39;</span>]));<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setBold</span>(<span style="color:#f92672;">true</span>);<br/><span style="color:#66837f;background-color:#191f26;">// &nbsp; &nbsp;$textRun-&gt;getFont()-&gt;setSuperScript(false); //</span><span style="color:#66837f;background-color:#191f26;font-family:&#39;宋体&#39;;">下标</span><span style="color:#66837f;font-family:&#39;宋体&#39;;"><br/></span><span style="color:#66837f;font-family:&#39;宋体&#39;;"> &nbsp; &nbsp;</span>$textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setName</span>(<span style="color:#e6db74;">&quot;Century Gothic&quot;</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setSize</span>(<span style="color:#ae81ff;">16</span>);<br/> $textRun<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">getFont</span>()<span style="color:#f92672;">-&gt;</span><span style="color:#a6e22e;">setColor</span>(<span style="color:#f92672;">new </span><span style="color:#f57dac;">Color</span>(<span style="color:#e6db74;">&#39;FF000000&#39;</span>));</pre><p><img src="http://img.80zx.com/ueditor/image/202002/1582626996e65f28.png" title="image" alt="image"/></p>
相关文章
热门推荐