Expand my Community achievements bar.

SOLVED

get exData body of a static text

Avatar

Former Community Member

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
Former Community Member

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

10 Replies

Avatar

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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
Former Community Member

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

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----