Changing Font size and type face for all field??

chrisb29762052 13-05-2015

Because copy and paste bring the font size and type with it I want to create a  script that change it

I tried to make happen at the "exit" function of the the field as follow :

form1.TestPage.Subform1.TextField1.font.size = "10pt";

form1.TestPage.Subform1.TextField1.font.typeface = "Myriad Pro";

I also tried a button that find all field by modifying a script that I found on line but it doesn't work for me:

function ProcessTextEdit(oField)

{

}

function ProcessAllFields(oNode)

{

  if (oNode.className == "subform" )

  {

  // Look for child fields.

  for (var i = 0; i < oNode.nodes.length; i++)

  {

  var oChildNode = oNode.nodes.item(i);

  ProcessAllFields(oChildNode);

  }

  }

  else if (oNode.className == "field")

  {

  switch (oNode.ui.oneOfChild.className)

  {

  case "textEdit":

  if(oNode.parent.className == "Subform")

  {

  form1.TestPage.Subform1.TextField1.font.size = "10pt";

  form1.TestPage.Subform1.TextField1.font.typeface = "Myriad Pro";

  }

  }

  }

}

No luck. Any suggestions?

Accepted Solutions (1)

Accepted Solutions (1)

chrisb29762052 01-06-2015

I was trying to only control font size and type while allowing users to  keep the flexibility to use color, bold, underline, etc to highlight some of the information when bringing there text over. Plain text does allow for it. So far, from all that I have read , this is not possible because Livecycle is not able to control the attribute of Rich Text from Word being imported into a Rich Text box in Livecycle.

Answers (9)

Answers (9)

sp215 01-06-2015

You have to change the field format to 'Plain Text Only' and use this.font.size = "xxpt"; on exit

You can then copy and paste text from MS Word into the Form and it will convert it to the same font size that you have selected

mouslander 23-05-2015

2 other options that may help

1- Do not make the field RTF. That way the copy and paste will be whatever the field properties are set for

if that will not work...

2- have a duplicate field that is hidden and not RTF. Use a script such as this.rawValue = otherfield.rawValue. Then on the save or print action hide the RTF and make the none RTF field visible. This could be a pain if there are multiple fields.

chrisb29762052 23-05-2015

Tried that. It will not apply against information that has been cut and pasted. Only against information type directly in the field.

Any other suggestions?

mouslander 19-05-2015

How many of the fields are RTF? you could put it on an exit script once the user leaves the field. That is easy enough if there are only a couple marked as RTF

chrisb29762052 13-05-2015

No. I understand that you can set font in Lifecycle. The fact is that when you use Rich text in your form and you copy and paste information from another source (ie: word documents,etc), the font attributes come with it. The form that I am creating will rely on cutting and pasting information from other sources. I don't want to end up with different font size and type once the form is completed. The only way I can see this happening is by running a script against all text fields to ensure that it is the same all across the form.