RowHeader represent a table row header.
Inheritance: IContent, IHtml
Exemplo n.º 1
0
		/// <summary>
		/// create the row header of the data table of the chart
		/// </summary>
		/// <param name="table"></param>
		/// <returns></returns>
		private RowHeader CreateRowHeader(Table table)
		{
			RowHeader   rowheader = new RowHeader (table);
			int startColumnIndex = m_tableData.startcell .columnIndex ;
			int endColumnIndex   = m_tableData.endcell .columnIndex ;
			Row  row              = new Row (table);
			Cell cell             = this.CreateNullStringCell (table);
			row.Cells .Add (cell);
			
			for(int i=startColumnIndex; i<=endColumnIndex; i++)
			{
				Cell  tempCell        = new Cell (table.Document);
				tempCell.OfficeValueType ="string";
				Paragraph   paragraph = new Paragraph (m_document);
				string  content       =((char)('A'+i-1)).ToString ()+"ĮŠ";
				paragraph.TextContent .Add (new SimpleText (m_document ,content));
				tempCell.Content .Add (paragraph);
				row.Cells .Add (tempCell);
	
			}
	
			rowheader.RowCollection .Add (row);
	
			return rowheader;
		}
Exemplo n.º 2
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);
        }
		/// <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;
		}
Exemplo n.º 4
0
        /// <summary>
        /// Return the content as Html string
        /// </summary>
        /// <returns>The html string</returns>
        public string GetHtml()
        {
            bool         isRightAlign = false;
            const string outerHtml    =
                "<table border=0 cellspacing=0 cellpadding=0 border=0 style=\"width: 16.55cm; \">\n\n<tr>\n<td align=right>\n";
            string html =
                "<table hspace=\"14\" vspace=\"14\" cellpadding=\"2\" cellspacing=\"2\" border=\"0\" bgcolor=\"#000000\" ";
            const string htmlRight = "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" bgcolor=\"#000000\" ";

            if (TableStyle.TableProperties != null)
            {
                if (TableStyle.TableProperties.Align != null)
                {
                    string align = TableStyle.TableProperties.Align.ToLower();
                    if (align == "right")
                    {
                        isRightAlign = true;
                        html         = htmlRight;
                    }
                    else if (align == "margin")
                    {
                        align = "left";
                    }
                    html += " align=\"" + align + "\" ";
                }
                html += TableStyle.TableProperties.GetHtmlStyle();
            }

            html += ">\n";

            if (RowHeader != null)
            {
                html += RowHeader.GetHtml();
            }

            foreach (Row row in Rows)
            {
                html += row.GetHtml() + "\n";
            }

            html += "</table>\n";

            //Wrapp a right align table with outer table,
            //because following content will be right to
            //the table!
            if (isRightAlign)
            {
                html = outerHtml + html + "\n</td>\n</tr>\n</table>\n";
            }

            return(html);
        }
Exemplo n.º 5
0
		private void FirstLineLabels()
		{
			RowHeader   rowHeader = new RowHeader (table);
			Row         row       = new Row (table);
			Cell        cell      = CreateNullStringCell(table);
			row.Cells .Add (cell);
			
			for(int i=startColumnIndex; i<=endColumnIndex;i++)
			{
				Cell cellTemp = m_tableData.table .Rows [startRowIndex-1].Cells[i-1];
				int  cellRepeated =0;
				string cellRepeating = cellTemp.ColumnRepeating ;
				
				if (cellRepeating!=null)
					cellRepeated = Int32.Parse (cellTemp.ColumnRepeating);
				
				if (cellRepeated >1)
				{
					for(int j=0; j<cellRepeated-1; j++)
					{
						row.Cells .Add (cellTemp);
						i++;
					}
				}
	
				row.Cells .Add (cellTemp);
	
	
			}
			
			rowHeader.RowCollection .Add (row);
			table.RowHeader = rowHeader;
	
			for(int j=startRowIndex;j<=endRowIndex; j++)
			{
				Row  tempRow     = new Row (table);
				tempRow.Cells .Add (CreateRowSerialCell(table,j+1));
				
				for(int k=startColumnIndex;k<endColumnIndex; k++)
				{
					Cell cellTemp = m_tableData.table .Rows [j].Cells[k];
					int  cellRepeated =0;
					string cellRepeating = cellTemp.ColumnRepeating;
	
					if (cellRepeating!=null)
						cellRepeated=Int32.Parse (cellTemp.ColumnRepeating);
	
					if (cellRepeated >1)
					{
						for(int m=0; m<cellRepeated-1; m++)
						{
							row.Cells .Add (cellTemp);
							j++;
						}
					}
	
					tempRow.Cells .Add (cellTemp);
	
				}
	
				table.Rows .Add (tempRow);
	
			}
		}
Exemplo n.º 6
0
		private void BothHasLabels()
		{
			Row    row  = new Row (table);
			Cell   cell = new Cell (table.Document);
			Paragraph  paragraph  = new Paragraph (m_document );
			cell.Content .Add (paragraph);
			row.Cells .Add (cell);
	
			RowHeader   rowheader = new RowHeader (table);
			
			for(int i=startColumnIndex; i<endColumnIndex ; i++)
			{
				Cell cellTemp = m_tableData.table .Rows [startRowIndex-1].Cells[i];
				
				string cellRepeating = cellTemp.ColumnRepeating ;
				
				int  cellRepeated=0;
	
				if (cellRepeating!=null)
					cellRepeated= Int32.Parse (cellTemp.ColumnRepeating);
	
				if (cellRepeated >1)
				{
					for(int j=0; j<cellRepeated-1; j++)
					{
						row.Cells .Add (cellTemp);
						i++;
					}
				}
				
				row.Cells .Add (cellTemp);
	
			}
			
			rowheader.RowCollection .Add (row);
			
			table.RowHeader =rowheader;
	
	
			for(int i=startRowIndex; i<endRowIndex; i++)
				
			{
				Row tempRow = new Row (table);
				for(int j=startColumnIndex-1;j<endColumnIndex;j++)
				{
					Cell  cellTemp = m_tableData.table .Rows [i].Cells [j];
					string cellRepeating = cellTemp.ColumnRepeating;
					int   cellRepeated =0;
					
					if (cellRepeating!=null)
						cellRepeated= Int32.Parse (cellTemp.ColumnRepeating );
	
					if (cellRepeated>1)
						
					{
						for(int m=0; m<cellRepeated-1; m++)
						{
							tempRow.Cells .Add (cellTemp);
							i++;
						}
					}
	
					tempRow.Cells .Add (cellTemp);
				}
				
				table.Rows .Add (tempRow);
			}
		}
		/// <summary>
		/// Creates the table header row.
		/// </summary>
		/// <param name="node">The node.</param>
		/// <returns></returns>
		private RowHeader CreateTableHeaderRow(XmlNode node)
		{
			try
			{
				//Create a new Row
				RowHeader rowHeader			= new RowHeader(this._document, node);
				ContentCollection iColl	= new ContentCollection();
				//Recieve RowStyle
				IStyle rowStyle				= this._document.Styles.GetStyleByName(rowHeader.StyleName);

				if (rowStyle != null)
					rowHeader.Style				= rowStyle;
				//No need for a warning

				//Create the cells
				foreach(XmlNode nodeChild in rowHeader.Node.ChildNodes)
				{
					IContent iContent			= this.CreateContent(nodeChild);

					if (iContent != null)
					{
						//iColl.Add(iContent);
						AddToCollection(iContent, iColl);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a table row.", nodeChild));
					}
				}

				rowHeader.Node.InnerXml			= "";

				foreach(IContent iContent in iColl)
				{
					if (iContent is Row)
					{
						rowHeader.RowCollection.Add(iContent as Row);
					}
					else
					{
						this.OnWarning(new AODLWarning("Couldn't create IContent from a row header node. Content is unknown table row header content!", iContent.Node));
					}
				}
				return rowHeader;
			}
			catch(Exception ex)
			{
				throw new AODLException("Exception while trying to create a Table Row.", ex);
			}
		}
Exemplo n.º 8
0
        /// <summary>
        /// Creates the table header row.
        /// </summary>
        /// <param name="node">The node.</param>
        /// <returns></returns>
        private RowHeader CreateTableHeaderRow(XmlNode node)
        {
            try
            {
                //Create a new Row
                RowHeader rowHeader			= new RowHeader(this._document, node);
                IContentCollection iColl	= new IContentCollection();
                //Recieve RowStyle
                IStyle rowStyle				= this._document.Styles.GetStyleByName(rowHeader.StyleName);

                if(rowStyle != null)
                    rowHeader.Style				= rowStyle;
                //No need for a warning

                //Create the cells
                foreach(XmlNode nodeChild in rowHeader.Node.ChildNodes)
                {
                    IContent iContent			= this.CreateContent(nodeChild);

                    if(iContent != null)
                    {
                        iColl.Add(iContent);
                    }
                    else
                    {
                        if(this.OnWarning != null)
                        {
                            AODLWarning warning			= new AODLWarning("Couldn't create IContent from a table row.");
                            warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                            warning.Node				= nodeChild;
                            this.OnWarning(warning);
                        }
                    }
                }

                rowHeader.Node.InnerXml			= "";

                foreach(IContent iContent in iColl)
                {
                    if(iContent is Row)
                    {
                        rowHeader.RowCollection.Add(iContent as Row);
                    }
                    else
                    {
                        if(this.OnWarning != null)
                        {
                            AODLWarning warning			= new AODLWarning("Couldn't create IContent from a row header node. Content is unknown table row header content!");
                            warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                            warning.Node				= iContent.Node;
                            this.OnWarning(warning);
                        }
                    }
                }
                return rowHeader;
            }
            catch(Exception ex)
            {
                AODLException exception		= new AODLException("Exception while trying to create a Table Row.");
                exception.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
                exception.Node				= node;
                exception.OriginalException	= ex;

                throw exception;
            }
        }