Jump to content

Preserving Leading Spaces


albgjr

Recommended Posts

Posted

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

  • 2 years later...
Posted
Can you provide a visual example of RIGHT and WRONG? I would think you would use a tab instead of multiple spaces. You could also try using multiple non-breaking spaces --     -- although I would think a custom tab would be more effective.
Posted

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);

  • 2 weeks later...
Posted

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

Posted
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.

Just set the table cells to be right-aligned.

Posted

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

Posted
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...