Esempio n. 1
0
        public static string HTMLTableWithCellContents(string strTableID, int numberOfColumns, List <string> contents)
        {
            NumberOfColumnsInFileBrowseTable = numberOfColumns;

            HTMLTable table = new HTMLTable(strTableID);

            /*HTMLTableRow topRow = new HTMLTableRow();
             * HTMLTableCell topCell;
             * for (int i = 0; i < numberOfColumns; i++)
             * {
             *  topCell = new HTMLTableCell("&nbsp;", "column" + (i + 1).ToString());
             *  topRow.AddCell(topCell);
             * }
             * table.Rows.Add(topRow);
             */

            int          currentColumnCounter = 0;
            HTMLTableRow currentRow           = new HTMLTableRow();

            foreach (string strContent in contents)
            {
                HTMLTableCell currentCell = new HTMLTableCell(strContent);
                currentRow.AddCell(currentCell);

                if (moveColumn(ref currentColumnCounter) == 0)
                {
                    // Add last row?
                    if (currentRow != null)
                    {
                        table.Rows.Add(currentRow);
                    }

                    // Create new row
                    currentRow = new HTMLTableRow();
                }
            }

            // Final row in progress?
            if (currentRow.Cells.Count > 0)
            {
                // Pad out row with empty cells if required
                if (currentColumnCounter != 0)
                {
                    while (moveColumn(ref currentColumnCounter) != 0)
                    {
                        currentRow.AddCell("&nbsp;");
                    }
                }

                table.Rows.Add(currentRow);
            }

            // Write table
            return(table.ToString());
        }
Esempio n. 2
0
        public static string HTMLTableWithCellContents(string strTableID, int numberOfColumns, List<string> contents)
        {
            NumberOfColumnsInFileBrowseTable = numberOfColumns;

            HTMLTable table = new HTMLTable(strTableID);

            /*HTMLTableRow topRow = new HTMLTableRow();
            HTMLTableCell topCell;
            for (int i = 0; i < numberOfColumns; i++)
            {
                topCell = new HTMLTableCell("&nbsp;", "column" + (i + 1).ToString());
                topRow.AddCell(topCell);
            }
            table.Rows.Add(topRow);
            */

            int currentColumnCounter = 0;
            HTMLTableRow currentRow = new HTMLTableRow();
            foreach (string strContent in contents)
            {
                HTMLTableCell currentCell = new HTMLTableCell(strContent);
                currentRow.AddCell(currentCell);

                if (moveColumn(ref currentColumnCounter) == 0)
                {
                    // Add last row?
                    if (currentRow != null) table.Rows.Add(currentRow);

                    // Create new row
                    currentRow = new HTMLTableRow();
                }
            }

            // Final row in progress?
            if (currentRow.Cells.Count > 0)
            {
                // Pad out row with empty cells if required
                if (currentColumnCounter != 0)
                {
                    while (moveColumn(ref currentColumnCounter) != 0)
                    {
                        currentRow.AddCell("&nbsp;");
                    }
                }

                table.Rows.Add(currentRow);
            }

            // Write table
            return table.ToString();
        }
Esempio n. 3
0
 public void AddCell(HTMLTableCell col)
 {
     Cells.Add(col);
 }
Esempio n. 4
0
 public void AddCell(HTMLTableCell col)
 {
     Cells.Add(col);
 }