设置文本字段默认值的字体格式

斯科特·霍尔兹曼

我是Adobe Acrobat的新手。我使用的是Adobe Acrobat ProX。基本上,我是从头开始创建一个可填写的表单。我想做的是能够格式化只读的texbox,使其显示如下内容:

虽然粗体文字,这段文字也不会大胆

上面是复选框或一系列填充文本框之前的一种标签。

我似乎找不到一种方法来使文本的仅一部分变为所需的粗体(或斜体)。我意识到我可以先构建这个词,然后再创建PDF,但是,由于表单(及其可填充)控件的设计可能会发生变化,因此每次不得不重新设计控件似乎很麻烦。我也意识到我可以添加单独的文本框,选择-Bold-Oblique字体类型,但这似乎也很痛苦。

我愿意接受最有效的解决方案。添加填充字段后,如果有一种简便的方法可以从Word中进行设计更改。我也对此持开放态度。

STTR

Adobe LiveCycle Designer中的Craft表单和文本框-Adobe Acrobat Pro X的一部分。

Designer中TextField的RichText技巧

使用Adobe LiveCycle Designer(Shift + F11)中的“制表顺序”和“层次结构”窗口进行导航。

Adobe Acrobat Pro X

文本字段属性->选项->自定义计算脚本>

查看!允许富文本格式!!!

文本字段属性->计算->自定义计算脚本>编辑...

var ObjectName = "Text1";
var JoinArrayStyle = new Array();

JoinArrayStyle[0] = new Object();
JoinArrayStyle[0].text = "While ";
JoinArrayStyle[0].textSize = 22;
JoinArrayStyle[0].textColor = color.red;

JoinArrayStyle[1] = new Object();
JoinArrayStyle[1].text = "this text is bold";
JoinArrayStyle[1].fontWeight = 900;
JoinArrayStyle[1].textSize = 24;
JoinArrayStyle[1].textColor = color.dkGray;

JoinArrayStyle[2] = new Object();
JoinArrayStyle[2].text = ", this text will not be bold.";
JoinArrayStyle[2].textSize = 22;
JoinArrayStyle[2].textColor = color.black;

this.getField(ObjectName).richValue = JoinArrayStyle;

属性文本字段

允许富文本格式!!!

计算表Adobe Acrobat Javascript

Javascript窗口

结果 ...

谢谢!

计划B ...)))

Microsoft Word 2007 SP3-> Acrobat X Pro表单

创建简单表

选择表 选择表

将颜色边框更改为Adobe公司。默认样式))。在此处输入图片说明

按住Ctrl键和鼠标左键,鼠标指针悬停在所需的奇数行上,因此选择它们。右键单击任何突出显示的字段后,请选择“边框和底纹...”删除几行边框

选择表列后,将文本右对齐,按Ctrl + R或在面板中按按钮。 右对齐文字

删除左边框 删除左边框

呼叫边框和底纹对话框 边框和底纹对话框

在填充单元对话框中设置选项。 填充单元对话框

更改文本颜色工具Microsoft Word 2007。

未设置禁用的颜色(vbGrayText),并且无法在宏中使用...并且我将其设置为深灰色))。 更改文字颜色工具Microsoft Word 2007

Save as Pdf Microsoft Word 2007. I not use Adobe add-on. 另存为Pdf Microsoft Word 2007

Microsoft Word 2007 Pdf resolution quality. Microsoft Word 2007 Pdf分辨率质量

Microsoft Word 2007 Pdf options font.

PDF字体保存选项

Auto open pdf after save as Microsoft Word 2007 dialog.

另存为Microsoft Word 2007对话框后自动打开pdf

Create or edit Form dialog part I

创建或编辑表单对话框的第一部分

Create or edit Form dialog part II

创建或编辑表单对话框的第二部分

View Adobe Acrobat Pro X Form. View Adobe Acrobat Pro X Form

Save Arcobat Pro X Form. Save Arcobat Pro X Form

In paragraf field 3 text fragment ... View Adobe file

Plan C ...

Apache FOP create pdf file from XML. Command line:

foo.cmd -xml xslfoRef.xml -xsl xml2pdf.xsl -pdf xslfoRef.pdf

Apache FOP create TrueType Font Metrics:

java -cp build/fop.jar;lib\xmlgraphics-commons-1.4.jar;lib\commons-io-1.3.1.jar;lib\commons-logging-1.0.4.jar;lib/serializer-2.7.0.jar org.apache.fop.fonts.apps.TTFReader -ttcname "Cambria" %windir%\Fonts\CAMBRIA.TTC Cambria2.xml

Apache FOP create pdf include font Cambria:

fop.bat -c Cambria2.xml  -xml xslfoRef.xml -xsl xml2pdf.xsl -pdf xslfoRef.pdf

Adobe LiveCycle Designer

New Form in Adobe LiveCycle Designer New Form in Adobe LiveCycle Designer

Use balnk form Use balnk form

set orientation set orientation

add view XML add view XML

add subform, text and form field add subform, text and form field

Text not edit in Acrobar X Pro! text not edit in Acrobar X Pro

Edit form field in Adobe X Edit field in Adobe X

Text template | XSLT.1 | HTML template XML | XSLT.2 | WordML template | WSH/powershell script | Adobe Pdf

TBD: XSLT_1, XSLT_2 - style text

Text template -

textempl.txt:

Full Name:
Company:
Job Title:
e-mail:
Phone:
Descriptions:\While \this text is bold\, this text will not be bold

getxtxml.xml:

<!DOCTYPE properties [<!ENTITY textempltxt SYSTEM "textempl.txt">]>
<body> &textempltxt;</body>

XML HTML模板-

HTeMpLate.xml:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="xstyle.xss"?>
<body>
<table>
 <tr>
   <td class="field-style">Full Name: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">Company: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">Job Title: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">e-mail: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style">Phone: </td>
   <td class="adobe-style"></td>
 </tr>
 <tr>
   <td class="field-style"><i>Descriptions: </i></td>
   <td class="description">
       <font class="Red"    color="FF0000">While </font>
       <font class="dkGray" color="595959">this text is bold</font>
       <font class="None"   color="000000">, this text will not be bold</font>
   </td>
 </tr>                                               
</table>
</body>

XML CSS档案,

xstyle.xss:

@charset "UTF-8"; /* for Chrome Old ver */
/* test @: FireFox 18.0.1, Safari 5.1.7,Opera 12.12, Chrome 23.- 24., Internet Explorer 8  */
/* Style Sheets with XML */
body { display: block; width: 800px; align=left; border-width:0px; float:top; margin: 0; padding: 0; 
border: 0; outline: 0; vertical-align: baseline; background: transparent;}

table { display: table; width: 800px; align=right; float:top; 
border-spacing:10px;  /* FF18,Sf5,Op12,Ch24 eq IE8 margin-bottom: 10px; */
}

tr { display: table-row; width: 800px; float:top; margin-bottom:10px; }
td { display: table-cell; width: 400px; padding-left : 10px; padding-right: 10px; border-color: 1px solid #0070C0; text-align: right; float:top; }

td.field-style { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align : right; }
td.description { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align : left ; background-color: #FFFFE5;}
td.adobe-style { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align :     left ; border: 1px solid #0070C0;}

font.Red    { color: #FF0000; }
font.dkGray { color: #595959; font-weight: bold;}
font.None   { color: #000000; }

/* CSS3 FF18,Sf5,Op12,Ch24 */

tr > td[class="field-style"] { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align: right; }
tr > td[class="adobe-style"] { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align:  left; border: 1px solid #0070C0;}
tr > td[class="description"] { display: table-cell; width: 400px; padding-left: 10px; padding-right: 10px; text-align:  left; background-color: #FFFFE5;}

td > font[class="Red"   ] { color: #FF0000; }
td > font[class="dkGray"] { color: #595959; font-weight: bold;}
td > font[class="None"  ] { color: #000000; }

将HTeMpLate.xml-HTML模板转换为Word XML 2003 / WordML模板。

xml2wordml.cmd:

@echo off
msxsl.exe HTeMpLate.xml xml2wordml.xslt  -o wordml2003.xml

xml2wordml.xslt:

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xml:space="preserve">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
<xsl:preserve-space elements="td"/>
<xsl:template match="/">
<xsl:processing-instruction name="mso-application"><xsl:text>progid="Word.Document"</xsl:text></xsl:processing-instruction>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="body"><w:wordDocument xml:space="preserve" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
<w:styles>
 <w:style w:type="table" w:default="on" w:styleId="TableNormal">
  <w:name w:val="Normal Table"></w:name>
 </w:style>
</w:styles>
<w:body>
<xsl:apply-templates/>
<!--                         Page layout                 -->
<w:sectPr><w:pgSz w:w="16838" w:h="11906" w:orient="landscape"></w:pgSz></w:sectPr>
</w:body>
</w:wordDocument>
</xsl:template>
<!--                         Start Table                 -->
<xsl:template match="table">
<w:tbl>
<w:tblPr>
   <w:tblW w:w="9570" w:type="dxa"></w:tblW>
    <w:tblBorders>
     <w:top w:val="nil" />
     <w:left w:val="nil" />
     <w:bottom w:val="nil" />
     <w:right w:val="nil" />
    </w:tblBorders>
</w:tblPr>
<xsl:apply-templates select="*[name()]"/>
</w:tbl>
</xsl:template>
<xsl:template match="thead | tbody | tfoot">
<!--          WordProcessingML no equivalent                 -->
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="tr">
 <w:tr>
  <xsl:apply-templates />
 </w:tr>
<!--              Insert table row begin                     -->
<w:tr>
 <w:tc>
<w:tcPr><w:tcW w:w="4785" w:type="dxa"/></w:tcPr>
 <w:p></w:p>
 </w:tc>
 <w:tc>  
<w:tcPr><w:tcW w:w="4785" w:type="dxa"/></w:tcPr>
 <w:p></w:p>
 </w:tc>
</w:tr>
</xsl:template>
<!--              Table Header rule begin                    -->
    <xsl:template match="th">
<w:tc>
 <w:tcPr><w:tcW w:w="0" w:type="auto"/></w:tcPr>
  <w:p>
  <w:pPr><w:jc w:val="center"/></w:pPr>
  <w:r>
   <w:rPr><w:b/></w:rPr>
    <w:t><xsl:value-of select="."/></w:t>
    </w:r>
    </w:p>
    </w:tc>
        </xsl:template>
    <!--              Color Cell field-style begin              -->
    <xsl:template match="//tr/td[@class='field-style']">
     <w:tc>
      <w:tcPr><w:tcW w:w="0" w:type="auto"/>
      </w:tcPr>
  <w:p>
 <w:pPr><w:jc w:val="right" />
</w:pPr>
   <w:r>
<w:t><xsl:value-of select="."/></w:t>
   </w:r> 
  </w:p>
 </w:tc>
 </xsl:template>
<!--              Color Cell adobe-style begin              -->
<xsl:template match="//tr/td[@class='adobe-style']">
 <w:tc>
  <w:tcPr><w:tcW w:w="0" w:type="auto"/>
   <w:tcBorders>     
     <w:top     w:val="single" w:sz="2" w:color="0070C0"/>
     <w:left    w:val="single" w:sz="2" w:color="0070C0"/>
     <w:bottom  w:val="single" w:sz="2" w:color="0070C0"/>
     <w:right   w:val="single" w:sz="2" w:color="0070C0"/>
</w:tcBorders>
  </w:tcPr>
  <w:p>
 <w:pPr><w:jc w:val="left" />
</w:pPr>
   <w:r>
<w:t><xsl:value-of select="."/></w:t>
   </w:r> 
  </w:p>
 </w:tc>
 </xsl:template>
<!--              Color Cell description begin              -->
<xsl:template match="//tr/td[@class='description']">
<w:tc>
<w:tcPr><w:shd w:val="clear" w:color="auto" w:fill="FFFFE5" />
<w:tcW w:w="4279" w:type="dxa" /></w:tcPr>
  <w:p>
<xsl:for-each select="//tr/td[@class='description']/font">
<w:r>   
<w:rPr><w:color w:val="$getColor" /> </w:rPr>
<w:t><xsl:value-of select="."/></w:t> 
</w:r>
</xsl:for-each>
  </w:p>
 </w:tc>
</xsl:template>
<!--              Color Cell description end                -->
</xsl:stylesheet>     

将在2007 Word SP3中打开的文档另存为PDF,PowerShell脚本。

powershell .\word2pdf.ps1

word2pdf.ps1:

# word2pdf.ps1 STTR [email protected]
[int]$wdFormatPDF = 17
$SaveAsFormat = [int]$wdFormatPDF
$SaveAsExt=".pdf"
$word = New-Object -ComObject word.application 
$word.visible = $false 
$SourceDir="C:\DocSourceDir"
$i =0
$Files = Get-ChildItem $SourceDir -recurse -include *.txt,*.doc,*.docx,*.rtf,*.xml
Foreach ($file in $Files) {
$doc = $word.documents.open($file.fullname) 
$saveFile=$file.DirectoryName + '\' + $file.BaseName + $SaveAsExt
$doc.saveas($saveFile, $SaveAsFormat)
$doc.close() 
$i++
                          }
$word.Quit() 
$word = $null 
[gc]::collect() 
[gc]::WaitForPendingFinalizers()
write-host "Count : $i"

将在2007 Word SP3中打开的文档另存为PDF,WSH脚本:

cscript //Nologo doc2pdf.vbs wordml2003.xml

doc2pdf.vbs:

If WScript.Arguments.Count <1 then 
   Wscript.Echo "Ex.1: cscript //Nologo doc2pdf.vbs filename.ext"
   Wscript.Echo "Ex.2: cscript //Nologo doc2pdf.vbs wordml2003.xml"
   Wscript.Quit
End If

Dim strFilePath:strFilePath = WScript.Arguments.Item(0) 

docx2pdf strFilePath

Sub docx2pdf(OpenFile)
Const wdFormatPDF = 17

Dim WordDocument, FileProperties, strOpenFileName, strSavePDF

Dim FSO:Set FSO = CreateObject("Scripting.FileSystemObject")

    If FSO.FileExists(OpenFile) Then

Dim WordApplication:Set WordApplication = CreateObject("Word.Application")

    WordApplication.Visible = False
        Set FileProperties = FSO.GetFile(OpenFile)
        strOpenFileName = FileProperties.Path

    Else
        WScript.Echo "File Open Error: file not exist!"
        Exit Sub
    End If

    strSavePDF = FSO.BuildPath(FileProperties.ParentFolder, FSO.GetBaseName(FileProperties) & ".pdf")
    WordApplication.Documents.Open strOpenFileName
    Set WordDocument = WordApplication.ActiveDocument
    WordDocument.SaveAs strSavePDF, wdFormatPDF
    WordDocument.Close
    WordApplication.Quit(False)
End Sub 

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

如何在HTML文本字段(以表单形式)中将包含空格的字符串设置为默认值?

来自分类Dev

如何使用Selenium Python替换文本字段中的默认值?

来自分类Dev

用户单击数字时,Objective C文本字段的默认值从“•••••••”到“ 1•••••••”,“ 12•••••”,“ 123••••”

来自分类Dev

如何使用Selenium Python替换文本字段中的默认值?

来自分类Dev

用户单击数字时,Objective C文本字段的默认值从“•••••••”到“ 1•••••••”,“ 12•••••”,“ 123••••”

来自分类Dev

使用iText将文本字段添加为具有默认值的PDF表单

来自分类Dev

Applescript Automator默认文本字段值

来自分类Dev

设置Bindy字段的默认值

来自分类Dev

使用uidatepicker设置文本字段值

来自分类Dev

通过.value设置文本字段的值

来自分类Dev

使用 javascript 设置文本字段的值

来自分类Dev

JavaScript-如果在表单的文本字段中更改了默认值,则强制重定向

来自分类Dev

相反的字体格式

来自分类Dev

我对字体大小或文本字段大小的设置被忽略

来自分类Dev

Django表单向导-设置文本输入字段的默认值

来自分类Dev

使用iTextSharp在表格中设置字体格式

来自分类Dev

用户键入时设置文本字段的格式

来自分类Dev

Flutter –如何设置电话号码文本字段的格式

来自分类Dev

Android字体默认值/后备字体

来自分类Dev

如何为仅在Rails中的新表单的文本字段提供默认值?iam使用:value =>“ 0”。但是在编辑形式中,iam也获得'0'值

来自分类Dev

如何为仅在Rails中的新表单的文本字段提供默认值?iam使用:value =>“ 0”。但是在编辑形式中,iam也获得'0'值

来自分类Dev

在Django中使用classmethod设置字段的默认值

来自分类Dev

烧瓶表单字段的动态默认值设置

来自分类Dev

如何设置表单内选择字段的默认值

来自分类Dev

为Rails中的搜索字段设置默认值

来自分类Dev

Symfony2,设置日期时间字段的默认值

来自分类Dev

想要通过JavaScript设置输入字段的默认值

来自分类Dev

如何设置表单内选择字段的默认值

来自分类Dev

隐藏的文本字段将设置为其他“文本字段”值

Related 相关文章

  1. 1

    如何在HTML文本字段(以表单形式)中将包含空格的字符串设置为默认值?

  2. 2

    如何使用Selenium Python替换文本字段中的默认值?

  3. 3

    用户单击数字时,Objective C文本字段的默认值从“•••••••”到“ 1•••••••”,“ 12•••••”,“ 123••••”

  4. 4

    如何使用Selenium Python替换文本字段中的默认值?

  5. 5

    用户单击数字时,Objective C文本字段的默认值从“•••••••”到“ 1•••••••”,“ 12•••••”,“ 123••••”

  6. 6

    使用iText将文本字段添加为具有默认值的PDF表单

  7. 7

    Applescript Automator默认文本字段值

  8. 8

    设置Bindy字段的默认值

  9. 9

    使用uidatepicker设置文本字段值

  10. 10

    通过.value设置文本字段的值

  11. 11

    使用 javascript 设置文本字段的值

  12. 12

    JavaScript-如果在表单的文本字段中更改了默认值,则强制重定向

  13. 13

    相反的字体格式

  14. 14

    我对字体大小或文本字段大小的设置被忽略

  15. 15

    Django表单向导-设置文本输入字段的默认值

  16. 16

    使用iTextSharp在表格中设置字体格式

  17. 17

    用户键入时设置文本字段的格式

  18. 18

    Flutter –如何设置电话号码文本字段的格式

  19. 19

    Android字体默认值/后备字体

  20. 20

    如何为仅在Rails中的新表单的文本字段提供默认值?iam使用:value =>“ 0”。但是在编辑形式中,iam也获得'0'值

  21. 21

    如何为仅在Rails中的新表单的文本字段提供默认值?iam使用:value =>“ 0”。但是在编辑形式中,iam也获得'0'值

  22. 22

    在Django中使用classmethod设置字段的默认值

  23. 23

    烧瓶表单字段的动态默认值设置

  24. 24

    如何设置表单内选择字段的默认值

  25. 25

    为Rails中的搜索字段设置默认值

  26. 26

    Symfony2,设置日期时间字段的默认值

  27. 27

    想要通过JavaScript设置输入字段的默认值

  28. 28

    如何设置表单内选择字段的默认值

  29. 29

    隐藏的文本字段将设置为其他“文本字段”值

热门标签

归档