sandig199 Posted October 29, 2018 Posted October 29, 2018 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.pdfsample Spreadsheet.txt Quote
Dan Korn Posted November 1, 2018 Posted November 1, 2018 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. Quote
sandig199 Posted November 21, 2018 Author Posted November 21, 2018 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. Quote
Recommended Posts
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.