pagecreator:tutorials:excel:exporting_multiple_assortments
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| pagecreator:tutorials:excel:exporting_multiple_assortments [2012/09/18 14:44] – dave | pagecreator:tutorials:excel:exporting_multiple_assortments [2025/05/22 21:53] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| The " | The " | ||
| - | < | + | < |
| // Declare our global variables that will need to hold their values in | // Declare our global variables that will need to hold their values in | ||
| // other routines | // other routines | ||
| Line 49: | Line 49: | ||
| === OnBeforeData === | === OnBeforeData === | ||
| + | <code sqbasic> | ||
| + | // We need to figure out if we have enough rows left on this worksheet to | ||
| + | // fill in all the assortment UPCs | ||
| + | |||
| + | // max_rows variable is used to find how many extra rows we have. | ||
| + | // Its not essential when only using one list, but useful if we | ||
| + | // have multiple lists. | ||
| + | max_rows = 0 | ||
| + | |||
| + | // Create our TStringList to hold the valid UPCs | ||
| + | slUPCs = TStringList.Create | ||
| + | // enumerate all of the " | ||
| + | for i = 1 to 40 | ||
| + | szUPC = trim(SQForm.Link(" | ||
| + | if (szUPC <> "" | ||
| + | | ||
| + | | ||
| + | end if | ||
| + | next | ||
| + | |||
| + | // EndingRow is the row offset of the last row for this group | ||
| + | // Since the first " | ||
| + | EndingRow = max_rows + Row | ||
| + | </ | ||
| === OnAfterData === | === OnAfterData === | ||
| + | <code sqbasic> | ||
| + | // FIRST_ROW is the first valid row in the Excel. | ||
| + | FIRST_ROW = 22 | ||
| + | // FORMULA_AG is a formula template - put here to make it easier to find if changes are necessary | ||
| + | FORMULA_AG = " | ||
| + | |||
| + | ws = excel.ActiveSheet | ||
| + | |||
| + | // main_row is the current row | ||
| + | main_row = FIRST_ROW + Row - 1 | ||
| + | |||
| + | // We want to export the correct formula in cell AG for the current row | ||
| + | exportFormula(ws, | ||
| + | |||
| + | // xlRow is the actual row in Excel we will output into | ||
| + | for xlRow = main_row + 1 to FIRST_ROW + EndingRow | ||
| + | // idx is the index into the current lists | ||
| + | idx = xlRow - main_row - 1 | ||
| + | // output to Excel - GetUPC is a Global function to make it easier to get the correct UPC value | ||
| + | ws.Range(" | ||
| + | | ||
| + | // We want to export the correct formula in cell AG for each UPC row | ||
| + | exportFormula(ws, | ||
| + | next | ||
| + | |||
| + | // Remember to free any lists you create in OnBeforeData | ||
| + | slUPCs.free | ||
| + | |||
| + | // Set the current row to the EndingRow. | ||
| + | Row = EndingRow | ||
| + | </ | ||
pagecreator/tutorials/excel/exporting_multiple_assortments.1347979448.txt.gz · Last modified: (external edit)
