Jump to content

Recommended Posts

Posted

Hello all:

 

I was wondering if you can provide me with some assistance.

 

I have a table that contains a variable amount of rows based on the number of dependents each record contains.

 

I have found this logic from a previous thread and it works great:

 

var fields = [[Rule("Dep1_Rule"),Field("dep1dob"),Field("dep1rel")],[Field("dep2fname") + " " + Field("dep2lname"), Field("dep2dob"), Field("dep2rel")],[Field("dep3fname") + " " + Field("dep3lname"),Field("dep3dob"), Field("dep3rel")],

[Field("dep4lfname") + " " + Field("dep4lname"),Field("dep4dob"), Field("dep4rel")],[Field("dep5fname") + " " + Field("dep5lname"),Field("dep5dob"), Field("dep5rel")],[Field("dep6fname") + " " + Field("dep6lname"),Field("dep6dob"), Field("dep6rel")]];

 

var myTable = new FPTable;

myTable.AddColumns(14400, 6100, 8500);

myTable.AddRows(6);

 

for (var i=0; i<6; i++) {

if (fields[2] != "") {

myTable.Rows.Cells[0].Font="Calibri"

myTable.Rows.Cells[0].PointSize = 10;

myTable.Rows.Cells[0].SetBorders("Thin","Black","Top","Bottom","Right","Left");

myTable.Rows.CopyCells(0,1,2);

myTable.Rows.Cells[0].HAlign = "Left";

myTable.Rows.SetContents(fields[0], fields[1], fields[2]);

}

}

return myTable.MakeTags();

 

The problem I'm having is that I need to be able to add a header row (3 Columns) that contain "Name", "Birth Date", "Relationship".

 

I've tried a couple of things but nothing seems to work. I'm pretty new to making tables so any assistance you can provide would be appreciated.

Posted

Maybe try something like this:

 

    var headerRow = myTable.AddRow();
   myTable.Rows[0].Cells[0].Font = "Arial";
   myTable.Rows[0].Cells[0].PointSize = 10;
   myTable.Rows[0].Cells[0].HAlign = "Center";
   myTable.Rows[0].Cells[0].SetBorders("Thin","Black","Bottom");
   myTable.Rows[0].Cells[0].Margins = new FPTableMargins;
   myTable.Rows[0].Cells[0].Margins.Top = 10;
   myTable.Rows[0].Cells[0].Margins.Bottom = 10;
   myTable.Rows[0].CopyCells(0,1,2);
   myTable.Rows[0].Cells[0].Content = "Name";
   myTable.Rows[0].Cells[1].Content = "Birth Date";
   myTable.Rows[0].Cells[2].Content = "Relationship";

 

This is obviously from a table I have so if you don't need the font and border tags you could remove those.

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