首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在超文本标记语言中对齐文本?(Netsuite AdvancedPDF)

如何在超文本标记语言中对齐文本?(Netsuite AdvancedPDF)
EN

Stack Overflow用户
提问于 2019-10-07 22:16:48
回答 1查看 552关注 0票数 0

我正在创建一个高级的阿拉伯语PDF。这是一种只有阿拉伯文字的字母。这是不合理的。我尝试在<td><span>中使用style="text-align: justify; text-justify: inter-word;",但仍然没有用。

有没有人能告诉我,是否有可能证明阿拉伯语是合理的?我的脚本块:

代码语言:javascript
复制
<?xml version="1.0"?>
<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<!-- <pdf dir="rtl" lang="ar"> -->
<pdf>

  <head>
    <!-- arabic Font -->
    <link name="majalla" type="font" subtype="opentype"
      src="https://5486702.app.netsuite.com/core/media/media.nl?id=8627&amp;c=5486702&amp;h=3e47c429eda24f454f39&amp;_xt=.ttf"
      bytes="6" />
    <style type="text/css">
      body {
        font-family: majalla;
        font-size: 18pt;
      }
    </style>
  </head>

  <body font-famly="ariel" header="nlheader" header-height="14%" footer="nlfooter" footer-height="20pt"
    padding="0.5in 0.7in 0.5in 0.7in" size="Letter">
    <table width="100%" table-layout="fixed">
      <tr margin-top="10px">
        <td align="right" lang="Ar">
          <#if record.custbody7?has_content>
            <p align="right"><span align="right" style="text-align: justify; text-justify: inter-word;">${record.custbody7}</span>
              <#else>
                <p align="right" style="text-indent: 35px;"><span align="right">أفيدكم بأنه لا مانع لدينا من قيامكم
                    بتنفيذ المشروع أعلاه وذلك لمدة </span>
                  <span align="right" style="text-align: justify; text-justify: inter-word;">(
                    ${record.custbody_duration?string?replace('0','٠')?replace('1','١')?replace('2','٢')?replace('3','٣')?replace('4','٤')?replace('5','٥')?replace('6','٦')?replace('7','٧')?replace('8','٨')?replace('9','٩')}
                    )</span> <!-- duration -->
                  <span align="right" style="text-align: justify; text-justify: inter-word;"> تبدأ من تاريخ </span>
                  <span align="right" style="text-align: justify; text-justify: inter-word;">${record.custbody_start_date?string?replace('0','٠')?replace('1','١')?replace('2','٢')?replace('3','٣')?replace('4','٤')?replace('5','٥')?replace('6','٦')?replace('7','٧')?replace('8','٨')?replace('9','٩')}
                    م ، </span> <!-- start date -->
          </#if>
          <span align="right" style="text-align: justify; text-justify: inter-word;">ومن ثم ترفع المطالبات للإدارة المالية بتقديم جميع المستندات المؤيدة للصرف علًما بأن أصل
            هذا التعميد لدى الإدارة المالية في مكتب برنامج خدمة ضيوف الرحمن. </span>
          </p>
        </td>
      </tr>
    </table>
  </body>
</pdf>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-10-07 22:28:09

在很多地方,你都在使用<span align="right">。这里有三个问题:

1.) span是一个内联元素-在内联元素中使用文本对齐是无用的。使用div而不是span。这是一个块元素,它的默认宽度是其父元素的全宽,所以文本对齐方式会有影响。

2.) align="right"不是有效的HTML属性。如果想要直接将对齐添加到像div这样的元素,则必须使用<div style="text-align: right;">。或者(最好)将一个类应用于DIV,并为该类设置一个CSS规则,其中包含所需的文本对齐方式。如果希望文本对齐,请改用<div style="text-align: justify;">

3.)对于从右向左编写的语言,您不仅使用右对齐,还添加了一个文本方向参数,如direction: rtl; ("right to left"),所以所有这些参数加在一起就是<div style="text-align: justify; direction: rtl;">,或者(更好的)包含您应用于HTML标签的那些设置的类的CSS规则。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58271436

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档