Exemplo n.º 1
0
 void handleCustomScripts(ReportModel model, ResultPage page, ResultTable table)
 {
     for (int row = 0; row < table.Lines.Count; row++)
     {
         var line = table.Lines[row];
         for (int col = 0; col < line.Length; col++)
         {
             var cell = line[col];
             if (cell.Element != null && !string.IsNullOrWhiteSpace(cell.Element.CellScript))
             {
                 cell.ContextRow = row;
                 cell.ContextCol = col;
                 cell.ContextTable = table;
                 cell.ContextPage = page;
                 cell.ContextModel = model;
                 executeCellScript(cell);
             }
         }
     }
 }
Exemplo n.º 2
0
        public void InvertDataTables()
        {
            foreach (ResultPage page in Pages)
            {
                if (Report.Cancel) break;

                if (page.DataTable.Lines.Count > 0)
                {
                    ResultTable newTable = new ResultTable();
                    for (int i = 0; i < page.DataTable.Lines[0].Length; i++)
                    {
                        ResultCell[] newLine = new ResultCell[page.DataTable.Lines.Count];
                        for (int j = 0; j < page.DataTable.Lines.Count; j++)
                        {
                            newLine[j] = page.DataTable.Lines[j][i];
                        }
                        newTable.Lines.Add(newLine);
                    }

                    //Revert start row and column
                    newTable.BodyStartRow = page.DataTable.BodyStartColumn;
                    newTable.BodyStartColumn = page.DataTable.BodyStartRow;
                    //Calculate body end
                    for (int i = 0; i < page.DataTable.Lines[0].Length; i++)
                    {
                        if (!page.DataTable.Lines[0][i].IsTotal) newTable.BodyEndRow++;
                    }
                    page.DataTable = newTable;
                }
            }
        }