Jump to content

How to decrease line height in table with multi-line records


cwolford

Recommended Posts

Hello,

I am using FusionPro Creator 10.0.16 on Windows. I have created a table and I need to reduce the leading between lines to the lines fit a static table graphic in my template. I've tried line-height and magnify but I must be getting the syntax wrong.

 

Here is the rule I'm using to build my table.

 

var table = new FPTable();

table.AddColumns(8500,38500,7200);

 

var data = FusionPro.GetMultiLineRecords();

for (var rec = 1; rec <= data.recordCount; rec++)

{

function ExField(str)

{ return TaggedTextFromRaw(data.GetFieldValue(rec, str)); }

 

 

var content = ["DATE","DESCRIPTION","OPEN-AMT"].map(ExField);

 

var row = table.AddRow();

 

row.SetContents.apply(row, content);

 

// row.Cells[0].Margins = row.Cells[1].Margins = { Top:0, Bottom:0, Left:0, Right:0 };

 

}

 

 

return table.MakeTags();

 

Thanks for any suggestions!

Clint

Link to comment
Share on other sites

You can adjust the space between rows in a table by adjusting the top and bottom margins of the row's cells (must be greater than 0). Additionally, you can set a minimum height for the row itself.

 

If you want your rows to be (at least) 15pts tall, add this to your code:

var table = new FPTable();
table.AddColumns(8500, 38500, 7200);

var data = FusionPro.GetMultiLineRecords();

for (var rec = 1; rec <= data.recordCount; rec++) {
 function ExField(str) { return TaggedTextFromRaw(data.GetFieldValue(rec, str)); }

 var content = ["DATE","DESCRIPTION","OPEN-AMT"].map(ExField);
 var row = table.AddRow();
 [color="Red"]var [cell] = row.Cells;

 cell.Margins = { 'Top': 1, 'Bottom': 1, 'Left': 0, 'Right': 0 };
 cell.VAlign = 'Bottom';

 row.CopyCells(0, 1, 2);
 row.minHeight = 15 * 100; // 15 pt row height.[/color]
 row.SetContents.apply(row, content);
}

return table.MakeTags();

Link to comment
Share on other sites

Hey Step,

 

Thanks for the suggestion. I used the margin adjustment as you can see in my code sample and it gives me the ability to increase the leading between lines, but what I need to do is decrease the default line leading of 120 in order to get these lines closer. I tried setting the minimum row to 10 but it did not move the lines.

 

Any other suggestions?

 

Clint

Link to comment
Share on other sites

I used the margin adjustment as you can see in my code sample

I see a line of code that contains the word "Margins" but it is commented out, incorrectly defined, and the "Top" and "Bottom" properties are set to zero (which I noted wouldn't work in my response).

 

it gives me the ability to increase the leading between lines, but what I need to do is decrease the default line leading of 120 in order to get these lines closer. I tried setting the minimum row to 10 but it did not move the lines.

Again, you are not setting the leading – you are setting the minimum height of the row and the margins of the cells within the row. If setting the minimum height to 10 points and the top/bottom margins to 1 resulted in no visible difference then it makes me think the content of the row requires more space than a 10 pt row. Do your cells consist of multi-line content?

 

You can adjust the leading of cell's content just like you would any other rule, though – just adjust the leading in the text editor.

 

If you're still having problems, it would be helpful if you'd collect your template so that I could get a better idea of what you're trying to accomplish.

Link to comment
Share on other sites

Step,

 

I commented out the margin because it allowed me to increase the distance between the lines but not decrease. I am trying to decrease the space between the lines. I stripped out all of the extra code and attached the template.

 

I did try adjusting the leading in the text dialogue but this does not seems to affect the text within a table.

 

Thanks again for your help!

Clint

Invoice Sample 4 Clint Wolford.zip

Link to comment
Share on other sites

Try changing:

  function ExField(str) { return TaggedTextFromRaw(data.GetFieldValue(rec, str)); }

To something like this:

  function ExField(str) { return '<p br=false linespacing=0.8>' + TaggedTextFromRaw(data.GetFieldValue(rec, str)); }

You may need to play around with the "linespacing" value, which represents how many lines should be used for spacing with auto-leading. So 1 is nominal spacing, 2 is double-spacing, etc. Numbers less than one will collapse the lines closer together than nominal, which could result in collisions.

Link to comment
Share on other sites

Step,

I tried your code adds again and it looks like that did the trick! My template was just not refreshing before. The minimum height allowed me to adjust the space between the lines so it works over the lined graphic in the template background.

 

Thanks again!

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