Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

get exData body of a static text

Avatar

Level 2

Hi experts,

I've got a static text as follow (xml source)

        <draw minH="20mm" name="Text" w="190mm" x="0.6477mm" y="201.971mm">

            <ui>

               <textEdit>

                  <margin/>

               </textEdit>

            </ui>

            <value>

               <exData contentType="text/html">

                  <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="2.5.6290.0"><p style="text-align:justify;font-family:Arial;text-decoration:none">Il sottoscritto<span style="xfa-spacerun:yes"> </span</body>

               </exData>

            </value>

         </draw>

I need to change the body formatting dynamically.

I've tried with exData.saveXML() function but this returns

<?xml version="1.0" encoding="UTF-8"?>

<exData contentType="text/html"/>

how can I get the body xml?

Best regards,

Dariush

1 Accepted Solution

Avatar

Correct answer by
Level 10

The floating field is just like any other field on your form except it is resolved at Render time. In your case you shoudl be able to manipulate the content of the TextField programmatically to achieve what you want.

Paul

View solution in original post

0 Replies

Avatar

Level 10

You will want to use this expression:

 

FieldName.value.exData.saveXML("pretty");

The pretty parameter merely gives you a nicer format to view.

Paul

Avatar

Level 2

Hi Paul,

the function saveXML (with or without 'pretty') works fine when applied to a text field, but not when applied to a static text.

This from my point of view.

Dariush.

Avatar

Level 10

I used this:

 

Text1.value.exData.saveXML("pretty")

It returned this:

<?xml version="1.0" encoding="UTF-8"?>

<exData contentType="text/html" xmlns="http://www.xfa.org/schema/xfa-template/3.5/">

   <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"><p style="text-decoration:none;letter-spacing:0in">This is a<span style="xfa-spacerun:yes"> </span><span style="font-weight:bold;text-decoration:underline">test<span style="xfa-spacerun:yes"> </span></span></p></body>

</exData>

The body tag has the formatting and the value that is in teh text object.

Are you not seeing the somethig similar?

Paul

Avatar

Level 2

to me it works in textfield case, not in case of static text

please have a look to the following

http://dl.dropbox.com/u/21852816/richText.pdf

Thank you very much.

Dariush.

Avatar

Level 10

It worked for me ...here is what I got back

?xml version="1.0" encoding="UTF-8"?>

<exData contentType="text/html" xmlns="http://www.xfa.org/schema/xfa-template/3.5/">

   <body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="2.5.6290.0"><p style="text-decoration:none">Rich static text<span style="xfa-spacerun:yes">  </span><span xfa:embed="#floatingField000041" xfa:embedMode="raw" xfa:embedType="uri"/></p></body>

</exData>

I highlight the text from the field in the returned value in green

Paul

Avatar

Level 10

Works for me …this is what I get back:

?xml version="1.0" encoding="UTF-8"?>

I highlighted the text is green so you can see it better!

Paul

Avatar

Level 2

Hi Paul,

testing that file with adobe reader X it works, with acrobat 8 no...

Unfortunately I cannot use in production the X version, only the 8.1...

Any workaround?

Best regards,

Dariush.

Avatar

Level 10

Sounds like it might have been a bug in version 8 that has since been fixed .....what if you used a textfield with no borders or background that was set to be locked so that it was not a tab stop for the user ..in this way you are turning it into a text object .

Paul

Avatar

Level 2

Yep this could work, but I wanted to modify the static text content due to a floating field, present in that element, which must be blue during editing and that should become black at printing time.

Walking around forum I've found other approaches to that (i.e. for each floating field use a pair of ffields, one blue, one black, and switch the rawData between the ffields in pre and post print processes), I wanted an easier way to do that.

Dariush.

Avatar

Correct answer by
Level 10

The floating field is just like any other field on your form except it is resolved at Render time. In your case you shoudl be able to manipulate the content of the TextField programmatically to achieve what you want.

Paul