Jump to content

Preserving Leading Spaces


albgjr

Recommended Posts

Hi everyone...

 

I have a project where text fields in the database has "leading spaces" that needs to be preserved when used in FusionPro text box. I notice that when the field is the first in the line, FusionPro "remove or ignore" the leading spaces.

 

If I add any character in front of the field, FusionPro display the leading spaces properly...

 

Any ideas? I do need the leading spaces and I cannot afford to "add" anything in front of the field...

 

Help?!?!

 

Thanks in advance...

 

AG

Link to comment
Share on other sites

  • 2 years later...

Make a rule with the same name as the field and this syntax (replacing your field name):

return TaggedTextFromRaw(Field("YourFieldName")).replace(/^(&[size=3]#[/size]32;)/, ' ');

Make sure to check "Treat returned strings as tagged text".

 

Or, if you have multiple fields for which you want to do this, you can do this in OnRecordStart instead:

for (var f in FusionPro.Fields)
   FusionPro.Composition.AddVariable(f, TaggedDataField(f).replace(/^(&[size=3]#[/size]32;)/, ' '), true);

Edited by Dan Korn
Prevent vBulletin from replacing entities
Link to comment
Share on other sites

  • 2 weeks later...

Thank you guys... I figured out the leading spaces problem; however, as you can see from the difference in these screenshots, the last two columns are not aligning.

 

In the data I will be using, each line is a separate field with a set number of spaces between each variable per line. It looks like fusion pro is not reading the spacing accurately. Can you help???

 

Test image:

http://i1298.photobucket.com/albums/ag42/cquinlin/test_zps2cbaf1a6.jpg

 

The final result should look like:

http://i1298.photobucket.com/albums/ag42/cquinlin/20130103_124108_zpsb81cedb6.jpg

Link to comment
Share on other sites

Dan,

 

The data is currently not in any table in Fusion pro...I have been calling for each line of text directly from the data...(Each line is one cell in my csv file).

 

Is there a way to make a table from an individual cell? If so, I am unaware of how to do this.

 

Thank you.

Colin

Link to comment
Share on other sites

The data is currently not in any table in Fusion pro...I have been calling for each line of text directly from the data...(Each line is one cell in my csv file).

Well, the picture you posted pretty much shouts out "table" to me. So if you're not making a table, you probably should be.

 

Or, set some tab stops to align on the decimal point. Then the rule could simply replace sets of spaces with <t> tags, like so:

for (var f in FusionPro.Fields)
   FusionPro.Composition.AddVariable(f, TaggedDataField(f).replace(/\s{1,10}/g, "<t>", true);

Is there a way to make a table from an individual cell? If so, I am unaware of how to do this.

I don't understand the question. You could make a table with a single cell, sure, but I'm not sure what that would get you.

 

At any rate, it's hard to tell why you're getting the output you're getting without seeing the job.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...