Column represent a table column.
Inheritance: IContent
Ejemplo n.º 1
0
		/// <summary>
		/// Creates the text document table.
		/// </summary>
		/// <param name="document">The document.</param>
		/// <param name="tableName">Name of the table.</param>
		/// <param name="styleName">Name of the style.</param>
		/// <param name="rows">The rows.</param>
		/// <param name="columns">The columns.</param>
		/// <param name="width">The width.</param>
		/// <param name="useTableRowHeader">if set to <c>true</c> [use table row header].</param>
		/// <param name="useBorder">The useBorder.</param>
		/// <returns></returns>
		public static Table CreateTextDocumentTable(
			AODL.Document.TextDocuments.TextDocument document, 
			string tableName, 
			string styleName, 
			int rows, 
			int columns, 
			double width, 
			bool useTableRowHeader, 
			bool useBorder)
		{
			string tableCnt							= document.DocumentMetadata.TableCount.ToString();
			Table table								= new Table(document, tableName, styleName);
			table.TableStyle.TableProperties.Width	= width.ToString().Replace(",",".")+"cm";

			for(int i=0; i<columns; i++)
			{
				Column column						= new Column(table, "co"+tableCnt+i.ToString());
				column.ColumnStyle.ColumnProperties.Width = GetColumnCellWidth(columns, width);
				table.ColumnCollection.Add(column);
			}

			if (useTableRowHeader)
			{
				rows--;
				RowHeader rowHeader					= new RowHeader(table);
				Row row								= new Row(table, "roh1"+tableCnt);
				for(int i=0; i<columns; i++)
				{
					Cell cell						= new Cell(table.Document, "rohce"+tableCnt+i.ToString());
					if (useBorder)
						cell.CellStyle.CellProperties.Border = Border.NormalSolid;
					row.Cells.Add(cell);
				}
				rowHeader.RowCollection.Add(row);
				table.RowHeader						= rowHeader;
			}

			for(int ir=0; ir<rows; ir++)
			{
				Row row								= new Row(table, "ro"+tableCnt+ir.ToString());
				
				for(int ic=0; ic<columns; ic++)
				{
					Cell cell						= new Cell(table.Document, "ce"+tableCnt+ir.ToString()+ic.ToString());
					if (useBorder)
						cell.CellStyle.CellProperties.Border = Border.NormalSolid;
					row.Cells.Add(cell);
				}

				table.Rows.Add(row);
			}

			return table;
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Creates the table column.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns></returns>
		private Column CreateTableColumn(XmlNode node)
		{
			try
			{
				//Create a new Row
				Column column				= new Column(this._document, node);
				//Recieve RowStyle
				IStyle columnStyle			= this._document.Styles.GetStyleByName(column.StyleName);

				if (columnStyle != null)
					column.Style			= columnStyle;
				//No need for a warning

				return column;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Table Column.", ex);
			}
		}
Ejemplo n.º 3
0
		private Column CloneColumn(Column column, Table table)
		{
			Column clonedColumn = new Column(table, column.StyleName);
			clonedColumn.ColumnStyle = column.ColumnStyle;
			return column;
		}
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the table column.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        private Column CreateTableColumn(XmlNode node)
        {
            try
            {
                //Create a new Row
                Column column				= new Column(this._document, node);
                //Recieve RowStyle
                IStyle columnStyle			= this._document.Styles.GetStyleByName(column.StyleName);

                if(columnStyle != null)
                    column.Style			= columnStyle;
                //No need for a warning

                return column;
            }
            catch(Exception ex)
            {
                AODLException exception		= new AODLException("Exception while trying to create a Table Column.");
                exception.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                exception.Node				= node;
                exception.OriginalException	= ex;

                throw exception;
            }
        }
Ejemplo n.º 5
0
		/// <summary>
		/// Creates the text document table.
		/// </summary>
		/// <param name="document">The document.</param>
		/// <param name="tableName">Name of the table.</param>
		/// <param name="styleName">Name of the style.</param>
		/// <param name="rows">The rows.</param>
		/// <param name="columns">The columns.</param>
		/// <param name="width">The width.</param>
		/// <param name="useTableRowHeader">if set to <c>true</c> [use table row header].</param>
		/// <param name="useBorder">The useBorder.</param>
		/// <returns></returns>
		private Table CreateTextDocumentTable(
			AODL.Document.TextDocuments.TextDocument document,
			string tableName,
			string styleName,
			int rows,
			int columns,
			double width,
			Table originalTable)
		{
			string tableCnt							= document.DocumentMetadata.TableCount.ToString();
			Table table								= new Table(document, tableName, styleName);
			table.TableStyle.TableProperties.Width	= width.ToString().Replace(",",".")+"cm";

			for(int i=0; i < columns; i++)
			{
				Column column						= new Column(table, originalTable.ColumnCollection[i].StyleName);
				//column.ColumnStyle.ColumnProperties.Width = GetColumnCellWidth(columns, width);
				table.ColumnCollection.Add(column);
			}

			for(int ir=0; ir < rows; ir++)
			{
				Row row								= new Row(table, originalTable.Rows[ir].StyleName);
				
				for(int ic=0; ic < columns; ic++)
				{
					Cell cell						= new Cell(table.Document, originalTable.Rows[ir].Cells[ic].StyleName);
					//if (useBorder)
					//	cell.CellStyle.CellProperties.Border = Border.NormalSolid;
					row.Cells.Add(cell);
				}

				table.Rows.Add(row);
			}

			return table;
		}