Jump to content

Formatted table help!


dleahy

Recommended Posts

*

Having trouble programming my first table. I keep getting ugliness in the FP preview...

Can anyone point me in the right direction here?

 

Here is what I have to accomplish:

 

http://postimage.org/image/ak802f4i9/http://s8.postimage.org/z0q5ww591/Screen_shot_2012_07_05_at_4_06_21_PM.png

 

We are going to be utilizing this as a FP template imported in MarcomCentral.

The Agenda fields will all be prefilled.

 

Any help is greatly appreciated!

 

Cheers,

-Dano

Edited by dleahy
Link to comment
Share on other sites

Just make a two-column table without any cell borders or margins, and set the text in the first column to green. Something like this:

var table = new FPTable;
table.AddColumns(6000, 20000); // set column widths here
for (var i = 1; i <= 4; i++)
{
   var row = table.AddRow();
   row.Cells[0].Content = '<color name="Green">' + TaggedDataField("Agenda Time " + i) + '</color>';
   row.Cells[1].Content = TaggedDataField("Agenda Paragraph " + i);
   row.Cells[0].Margins = row.Cells[1].Margins  = { Top:0, Bottom:0, Left:0, Right:0 };
}
return table.MakeTags();

Link to comment
Share on other sites

Thanks Dan! That's going to save me some serious time.

 

Is there a way to set line height of text or cell height? I couldn't find it in the TablerBuilder tutorial...

Getting some serious crunching of type...

 

Here is a screenshot:

http://s8.postimage.org/k6o18m8bp/Screen_shot_2012_07_06_at_9_50_08_AM.png

 

Cheers,

-Dano

Link to comment
Share on other sites

Is there a way to set line height of text or cell height? I couldn't find it in the TablerBuilder tutorial...

Getting some serious crunching of type...

Set the top and bottom margins to something other than zero.

 

P.S. I think I'd skip that dinner.

Link to comment
Share on other sites

Haha! Ya...I'd skip it too!

 

Alright..I thought it might have something to do with the margins..

 

Also

If I have to add a row that is separate from the dynamic rows. Like so:

http://s15.postimage.org/v5ejt2cl7/Screen_shot_2012_07_06_at_11_25_54_AM.png

 

See the Agenda all the way to the far left?

Everything else has to stay aligned as is.

 

How can I work the static text "Agenda" into your code on the same row?

 

Cheers,

-Dan

Link to comment
Share on other sites

See the Agenda all the way to the far left?

Everything else has to stay aligned as is.

 

How can I work the static text "Agenda" into your code on the same row?

Add another column as column 0 and populate it as needed. Add one to the other code to shift the columns over.

Link to comment
Share on other sites

Ya but how do I stop Agenda from duplicating down the rows and only stay in the first one.

 

http://s7.postimage.org/oedjg6wmj/Screen_shot_2012_07_06_at_12_44_20_PM.png

 

var table = new FPTable;
table.AddColumns(0,10810, 5200,7200); // set column widths here
for (var i = 1; i <= 5; i++)
{
   var row = table.AddRow();
   row.Cells[1].Content = "Agenda";
   row.Cells[2].Content = TaggedDataField("Time " + i) + " " + TaggedDataField("ampm " + i) ;
   row.Cells[3].Content = TaggedDataField("Agenda " + i);
   row.Cells[0].Margins = { Top:0, Bottom:2, Left:0, Right:0 };
   row.Cells[0].Font="SmithNephew"; 
   row.Cells[0].TextColor="Black";
   row.Cells[0].PointSize="9";
   row.Cells[1].Font="SmithNephew";
   row.Cells[1].Margins = { Top:0, Bottom:2, Left:0, Right:0 };
   row.Cells[1].PointSize="9";
   row.Cells[2].Font="SmithNephew"; 
   row.Cells[2].TextColor="Black";
   row.Cells[2].Margins = { Top:0, Bottom:2, Left:0, Right:0 };
   row.Cells[2].PointSize="9";
   row.Cells[3].Font="SmithNephew"; 
   row.Cells[3].TextColor="Black";
   row.Cells[3].PointSize="9";
   row.Cells[3].Margins = { Top:0, Bottom:2, Left:0, Right:0 };
}
return table.MakeTags();

I surely could benefit from a javascript 101 class or webinar...

Edited by dleahy
Link to comment
Share on other sites

Ya but how do I stop Agenda from duplicating down the rows and only stay in the first one.

...
for (var i = 1; i <= 5; i++)
{
   var row = table.AddRow();
[color=Red]    row.Cells[1].Content = "Agenda";[/color]
...

Just conditionalize it to only output that for the first row. Replace the line in red above with this:

if (i == 1)
   row.Cells[1].Content = "Agenda";

Or:

row.Cells[1].Content = (i == 1) : "Agenda" ? "";

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