使用Ms Access填写Adobe表单,该字段会删除前导零 [英] Filling in Adobe Form with Ms Access, field is dropping leading Zeros

查看:132
本文介绍了使用Ms Access填写Adobe表单,该字段会删除前导零的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正尝试使用ms访问和Acrobat对象填写Adobe PDF表单.我已经剪短了相关片段.我们能够成功填写大多数字段,但带有前导零(如邮政编码)的字段(应为字符串)除外.下面的代码显示了问题所在.

We are attempting to fill out a Adobe PDF form using, ms access and the Acrobat objects. I have cut to the relevant snippets. We are able to fill out most fields successfully, with the exception of fields (which should be strings), that have leading zeros (like a zip code). The code below shows the problem.

   'Initialize Acrobat by creating the App object.
   Set objAcroApp = CreateObject("AcroExch.App")

<狙击>

   'Create the AVDoc object.
    Set objAcroAVDoc = CreateObject("AcroExch.AVDoc")

   'Set the PDDoc object.
   Set objAcroPDDoc = objAcroAVDoc.GetPDDoc

   'Set the JS Object - Java Script Object.
   Set objJSO = objAcroPDDoc.GetJSObject

<狙击>

   objJSO.getfield("Zip Code").Value = "02110"

已填写Adobe表单,但将邮政编码的前0个旅馆删除.

The Adobe form is filled out BUT the leading 0 inn the zip code is dropped.

推荐答案

确保保留前面的零的一种可靠方法是强制使用字符串.一种简单的方法是在字符串中添加一个看起来像数字的空格字符,然后将其正确呈现.

A reliable way to make sure that preceeding zeroes are kept is to force a string. A simple way to do this is to add a space character to the string looking like a number, and it will then be rendered properly.

如果使用该表单来提交一些数据,则可能会有影响.

There may be implications if the form is used to submit back some data.

但是,如果您无法控制表单,那就是您可以拥有的.

But if you don't have control over the form, that's what you have at hand.

这篇关于使用Ms Access填写Adobe表单,该字段会删除前导零的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆