如何在HTML中对齐文本?(Netsuite AdvancedPDF)

问题描述 投票:0回答:1

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

任何人都可以给我一个主意,是否可以证明阿拉伯语?我的脚本块:

<?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>
html pdf netsuite suitescript
1个回答
0
投票

在服务器位置,您正在使用<span align="right">。这里有三个问题:

1。] span是一个内联元素–在内联元素中使用文本对齐是没有用的。使用div代替span。这是一个block元素,其默认宽度是其父元素的全宽,因此文本对齐将起作用。

2。)align="right"不是有效的HTML参数。如果要直接向div之类的元素添加路线,则必须使用<div style="text-align: right;">。或者(更好)将一个类应用于DIV,然后为该类设置一个CSS规则,其中包含所需的文本对齐方式。如果要使文本正确,请改用<div style="text-align: justify;">

3。)对于从右到左书写的语言,您不仅可以使用右对齐,还可以添加文本方向参数,例如direction: rtl;,因此总的来说就是<div style="text-align: justify; direction: rtl;">,或者(更好)CSS规则包含您应用于HTML标记的设置的类。

© www.soinside.com 2019 - 2024. All rights reserved.