Word = .OLEObject~New("Word.Application") Word~Visible = .TRUE -- make Word visible Document = Word~Documents~Add Selection = Word~Selection say "# 1: Create: title style..." Selection~Style = "Title" -- Create selection with style: Title Selection~TypeText("HELLO") -- give selection a text Selection~TypeParagraph excelApplication = .OLEObject~new("Excel.Application") excelApplication~visible = .true -- make Excel visible Worksheet = excelApplication~Workbooks~Add~Worksheets[1] colTitles = "ABCD" -- define first nine column letters lastLine = 5 -- number of lines to process sumFormula = "=sum(?2:?"lastLine-1")" -- English formula: question marks will be changed to column letter say "sumFormula: " sumFormula "(question marks will be changed to column letter)" xlHAlignRight = excelApplication~getConstant("xlHAlignRight") -- get value of "horizontal align right" constant do line = 1 to lastLine -- iterate over lines do col = 1 to colTitles~length -- iterate over columns colLetter = colTitles[col] -- get column letter cell = Worksheet~Range(colLetter||line) -- e.g. ~Range("A1") if line = 1 then do -- first row? yes, build title cell~value = "Klasse" colLetter -- header in first row cell~font~bold = .true -- make font bold cell~Interior~ColorIndex = 24 cell~style~horizontalAlignment = xlHAlignRight -- right adjust title end else if line = lastLine then do -- last row? yes, build sums /* set formula, e.g. "=sum(B2:B9)" */ cell~formula = sumFormula~changeStr("?",colLetter) -- adjust formula to column to sum up cell~Interior~ColorIndex = 17 end else do -- a row between 2 and 9: fill with random values cell~value = random(999999) / 100 -- create a random decimal value cell~font~ColorIndex = 11 -- set from black to violet end end end