Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Apr 01, 2021 3:42 pm

Hello All

I have a form to fill up using c#.net.
I can fill up all fields with success, but the form has 2 fields about phone number stays null after I set the value to field.
I found a function in innerxlm property used to mask these fields (Code below).

I used a code like kv.value = "1234567890" to set the value, but just after execute this line, the value is null.

How I can fill up this fields ?

Thanks, marcelo.


Following the function used to mask.

function mascaraTELDDD(){
//formato da máscara não permite digitação de letras
var re = /^\d*$/; //expressao regular (dentro de //), "^\d" (inicia em digito), "*"
var re0 = /^\d{1}$/;//expressão regular para entrar somente digito com 6 caracteres
var re1 = /^\(\d{3}$/;
var re2 = /^\(\d{2}\)\s\d{5}$/;
var ec; //event change

ec = xfa.event.change;// a marcara é aplicada enquanto é digitado

if (re.test(ec) == false){//se o valor (".test") for algum valor diferente de da variavel "re" ou seja diferente de dígito ele faz abaixo
app.beep();//caso ocorra erro
xfa.event.change = "";
}
else{
if(re0.test(xfa.event.newText) == true){
xfa.event.change = "(" + ec;
}
if(re1.test(xfa.event.newText) == true){
xfa.event.change = ") " + ec;//aplicação da máscara
}
if(re2.test(xfa.event.newText) == true){
xfa.event.change = "-" + ec;//aplicação da máscara
}
else if(xfa.event.newText.length > 14){
app.beep();//caso ocorra erro
xfa.event.change = "";
}
}

marcelo.araujo
 
Posts: 2
Joined: Thu Apr 01, 2021 1:27 pm

Fri Apr 02, 2021 9:57 am

Hello,

Thanks for your inquiry.
To help us investigate further, please provide your input file and your full test code of Spire.PDF you are using. You could send your file to us ([email protected]) via email. Thanks in advance.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Wed Apr 07, 2021 2:02 pm

Hi Elena,

Sample Document sent by email.

Following pieces if sample app code to fill up these fields.

Create Objetcts

PdfDocument doc = new PdfDocument();
doc.LoadFromFile("c:\\tempdoc\\Bradesco.pdf");
PdfFormWidget formWidget = doc.Form as PdfFormWidget;
List<XfaField> xfafields = formWidget.XFAForm.XfaFields;

Set Values

ClassFormBradesco.formBradesco form = new ClassFormBradesco.formBradesco();
ClassFormBradesco.formBRadescoCompradorPF compradorPF = new ClassFormBradesco.formBRadescoCompradorPF();
compradorPF.Documento_opcoesdeComprador_Comprador_CompradorPessoaFísica = "True";
compradorPF.Documento_CompradorPF_DadosdosCompradores_tele1 = "(31) 32190987";
compradorPF.Documento_CompradorPF_DadosdosCompradores_tele2 = "(31) 999991234";
form.CompradorPF = compradorPF;

Fill Form

case "form1[0].Documento[0].CompradorPF[0].DadosdosCompradores[0].tele1[0]":
xf.Value = compradorPF.Documento_CompradorPF_DadosdosCompradores_tele1 ;
break;
case "form1[0].Documento[0].CompradorPF[0].DadosdosCompradores[0].tele2[0]":
xf.Value = compradorPF.Documento_CompradorPF_DadosdosCompradores_tele2 ;
break;

Save File

doc.SaveToFile("c:\\tempdoc\\FillXfaField.pdf", FileFormat.PDF);
Console.ReadKey();


Marcelo.

marcelo.araujo
 
Posts: 2
Joined: Thu Apr 01, 2021 1:27 pm

Thu Apr 08, 2021 10:04 am

Hello Marcelo,

Thanks for providing you test code and you input file via email.
I tested your case and did notice that the fields DDD-telefone and DDD Celular cannot be filled correctly. I have posted this issue to our Dev team with the ticket SPIREPDF-4173 for further investigation. If there is any update, we will let you know. Apologize for the inconvenience caused.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF

cron