private void InitLines() { int startRow = 9, row; AlimentadorContent content = this.Content as AlimentadorContent; var lines = content.Lineas; String[] values; CellRange cellRange; row = startRow; var simRows = new int[] { 1, 2, 3, 4, 18 }; for (int i = 0; i < lines.Length; i++) { values = lines[i].GetValues(); for (int j = 0; j < values.Length; j++) { this.Write(values[j], row, j); if (!simRows.Contains(j)) { cellRange = CellRange.Create(this.Table, row, j, row + 1, j); this.Table.MergeCells(cellRange); } } //Línea descripción row++; //Descripción del Alimentador this.Write(lines[i].ToDesc, row, 1); this.Table.MergeCells(CellRange.Create(this.Table, row, 1, row, 4)); //Canalización this.Write(lines[i].Canal, row, 18); //Nueva línea row++; } }
/// <summary> /// Fixes the content by pages. /// </summary> /// <param name="fullContent">The full content.</param> /// <returns>La lista de contenidos</returns> /// <exception cref="Exception">Ningun contenido especificado</exception> internal static List <AlimentadorContent> FixContentByPages(AlimentadorContent fullContent) { List <AlimentadorContent> contentByPages = new List <AlimentadorContent>(); if (fullContent == null) { throw new Exception("Ningun contenido especificado"); } else if (fullContent.Lineas.Length > 20) { int max = (int)Math.Ceiling((double)fullContent.Lineas.Length / 20d); int pgIndex = 1; fullContent.PageCount = max; fullContent.PageIndex = 1; contentByPages.Add(fullContent); while (contentByPages.Last().Lineas.Length > 20) { var lines = contentByPages.Last().Lineas; var row = lines.Take(20); var skip = lines.Skip(20); lines = row.ToArray(); contentByPages.Last().Lineas = lines; var copy = contentByPages.Last().Clone(skip); copy.PageCount = max; copy.PageIndex = ++pgIndex; contentByPages.Add(copy); } } else { fullContent.PageCount = 1; fullContent.PageIndex = 1; contentByPages.Add(fullContent); } return(contentByPages); }