Jump to content

Recommended Posts

Posted

I need suggestions, please.

 

How does one create the table in the attached PDF from the data in the attached spreadsheet?

 

 

I planned on using a XDF file to drive the data into the tables.

 

The spreadsheet could be 100-1000 or more records, resulting in a multipage book.

 

 

Note the data is flowing in columns (not rows) on the PDF.

 

 

The bottom half of the PDF should be the next 6 records (not repeated like it shows in the example)

 

How do I get the "rows" on the spreadsheet into run in groups of 6 columns:

rows 1-6 on the top, rows 6-12 on the bottom.

 

 

The images, I think using an using external path to pull images into individual graphic frames above the table will work. The images do not have to be included in the table.

PRICE LIST TEMPLATE -- DBC UPHOLSTERY.pdf

sample Spreadsheet.txt

Posted

I got this to work with the following OnRecordStart rule:

if (FusionPro.Composition.inputRecordNumber != 1)
   FusionPro.Composition.composeThisRecord = false;

var data = new ExternalDataFileEx(PrimaryInputFile());
var numModels = Math.min(6, data.recordCount);
var numProps = data.fieldCount;

var table = new FPTable();
table.AddColumn(14000);
for (var c = 0; c < numModels; c++)
   table.AddColumn(6700);

for (var r = 0; r < numProps; r++)
{
   var row = table.AddRow();

   for (var c = 0; c <= numModels; c++)
   {
       var cell = row.Cells[c];
       cell.Content = TaggedTextFromRaw(data.GetFieldValue(c, r - 1));
       if (r == 0)
           cell.Content = c ? '<graphic file="' + data.GetFieldValue(c, "Image URL") + '" width=3500>' : "";
       cell.SetBorders("Thin", "Black", "Top", "Bottom", "Left", "Right");
       cell.Margins = {Top:10, Bottom:10, Left:20, Right:20};
       cell.HAlign = c ? "Center" : "Right";
       //cell.VAlign = "Middle";
       cell.Bold = c == 0 || r == 1;
   }
}

var result = table.MakeTags();
FusionPro.Composition.AddVariable("table", result, true);
return result;

I inserted the variable "table" into a text frame in 8-point text.

 

You'll have to make some adjustments to get exactly what you want, but that should get you started.

  • 3 weeks later...
Posted

Dan, this is awesome!

I apologize for the delay.

Your code was essential to getting me started on this!

We have been expanding upon it to allow for overflow pages and styling.

It is working beautifully.

 

Thank you so much.

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