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



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

谁能给我一个想法,是否有可能为阿拉伯语辩护? 我的脚本块:

<?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>

在你正在使用<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;("从右到左"(,因此总共会<div style="text-align: justify; direction: rtl;">,或者(更好(包含应用于HTML标签的那些设置的类的CSS规则。

最新更新